diff --git a/plugins/completion-ml-ranking/src/com/intellij/completion/ml/settings/CompletionMLRankingSettings.java b/plugins/completion-ml-ranking/src/com/intellij/completion/ml/settings/CompletionMLRankingSettings.java index d81dcdbfd76b..bf916d4b415c 100644 --- a/plugins/completion-ml-ranking/src/com/intellij/completion/ml/settings/CompletionMLRankingSettings.java +++ b/plugins/completion-ml-ranking/src/com/intellij/completion/ml/settings/CompletionMLRankingSettings.java @@ -36,8 +36,7 @@ public final class CompletionMLRankingSettings implements PersistentStateCompone myState = new State(); } - @NotNull - public static CompletionMLRankingSettings getInstance() { + public static @NotNull CompletionMLRankingSettings getInstance() { return ApplicationManager.getApplication().getService(CompletionMLRankingSettings.class); } diff --git a/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/AdditionalContextFeatureProvider.java b/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/AdditionalContextFeatureProvider.java index c8177344ff57..b4c7c6b9353c 100644 --- a/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/AdditionalContextFeatureProvider.java +++ b/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/AdditionalContextFeatureProvider.java @@ -14,8 +14,7 @@ import java.util.Map; public interface AdditionalContextFeatureProvider { LanguageExtension EP_NAME = new LanguageExtension<>("com.intellij.completion.ml.additionalContextFeatures"); - @NotNull - static List forLanguage(Language language) { + static @NotNull List forLanguage(Language language) { return EP_NAME.allForLanguageOrAny(language); } diff --git a/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/LookupFeatureProvider.java b/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/LookupFeatureProvider.java index 2b4beb18d697..7733ff0e8617 100644 --- a/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/LookupFeatureProvider.java +++ b/plugins/completion-ml-ranking/src/com/intellij/completion/ml/sorting/LookupFeatureProvider.java @@ -13,8 +13,7 @@ import java.util.Map; public interface LookupFeatureProvider { LanguageExtension EP_NAME = new LanguageExtension<>("com.intellij.completion.ml.lookupFeatures"); - @NotNull - static List forLanguage(Language language) { + static @NotNull List forLanguage(Language language) { return EP_NAME.allForLanguageOrAny(language); } diff --git a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeKeyGotoHandler.java b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeKeyGotoHandler.java index cda37196f985..4c2186f344bb 100644 --- a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeKeyGotoHandler.java +++ b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeKeyGotoHandler.java @@ -14,9 +14,8 @@ import ru.adelf.idea.dotenv.api.EnvironmentVariablesApi; import ru.adelf.idea.dotenv.util.EnvironmentVariablesUtil; public class DockerComposeKeyGotoHandler implements GotoDeclarationHandler { - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; } @@ -70,9 +69,8 @@ public class DockerComposeKeyGotoHandler implements GotoDeclarationHandler { return PsiElement.EMPTY_ARRAY; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlPsiElementsVisitor.java b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlPsiElementsVisitor.java index 54afdcf28cb7..afc945fd6848 100644 --- a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlPsiElementsVisitor.java +++ b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlPsiElementsVisitor.java @@ -54,8 +54,7 @@ class DockerComposeYamlPsiElementsVisitor extends PsiRecursiveElementVisitor { * FOO: [foobar] */ - @NotNull - private Collection getSequenceItems(@NotNull YAMLKeyValue yamlKeyValue) { + private @NotNull Collection getSequenceItems(@NotNull YAMLKeyValue yamlKeyValue) { PsiElement yamlSequence = yamlKeyValue.getLastChild(); if (yamlSequence instanceof YAMLSequence) { @@ -70,8 +69,7 @@ class DockerComposeYamlPsiElementsVisitor extends PsiRecursiveElementVisitor { * FOO: * bar: true */ - @NotNull - private Collection getMappingItems(@NotNull YAMLKeyValue yamlKeyValue) { + private @NotNull Collection getMappingItems(@NotNull YAMLKeyValue yamlKeyValue) { PsiElement yamlMapping = yamlKeyValue.getLastChild(); if (yamlMapping instanceof YAMLMapping) { diff --git a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlVariablesProvider.java b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlVariablesProvider.java index 5a2fed25bf8c..0352d28c28ed 100644 --- a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlVariablesProvider.java +++ b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerComposeYamlVariablesProvider.java @@ -13,9 +13,8 @@ import java.util.Collection; import java.util.Collections; public class DockerComposeYamlVariablesProvider implements EnvironmentVariablesProvider { - @NotNull @Override - public FileAcceptResult acceptFile(VirtualFile file) { + public @NotNull FileAcceptResult acceptFile(VirtualFile file) { if (file.getName().equals("docker-compose.yml") || file.getName().equals("docker-compose.yaml")) { return file.getFileType().equals(YAMLFileType.YML) ? FileAcceptResult.ACCEPTED : FileAcceptResult.NOT_ACCEPTED; } @@ -23,9 +22,8 @@ public class DockerComposeYamlVariablesProvider implements EnvironmentVariablesP return FileAcceptResult.NOT_ACCEPTED; } - @NotNull @Override - public Collection getElements(PsiFile psiFile) { + public @NotNull Collection getElements(PsiFile psiFile) { if (psiFile instanceof YAMLFile) { DockerComposeYamlPsiElementsVisitor visitor = new DockerComposeYamlPsiElementsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileKeyGotoHandler.java b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileKeyGotoHandler.java index 117ce6f88823..772cc1558ffe 100644 --- a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileKeyGotoHandler.java +++ b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileKeyGotoHandler.java @@ -12,9 +12,8 @@ import ru.adelf.idea.dotenv.util.EnvironmentVariablesUtil; public class DockerfileKeyGotoHandler implements GotoDeclarationHandler { - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null || psiElement.getParent() == null) { return PsiElement.EMPTY_ARRAY; } @@ -32,9 +31,8 @@ public class DockerfileKeyGotoHandler implements GotoDeclarationHandler { return EnvironmentVariablesApi.getKeyUsages(psiElement.getProject(), EnvironmentVariablesUtil.getKeyFromString((((DockerFileEnvRegularDeclaration) psiElement).getDeclaredName().getText()))); } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileVariablesProvider.java b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileVariablesProvider.java index 7ff6892d9b0d..bef62089fe20 100644 --- a/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileVariablesProvider.java +++ b/plugins/env-files-support/docker/src/ru/adelf/idea/dotenv/docker/DockerfileVariablesProvider.java @@ -13,15 +13,13 @@ import java.util.Collection; import java.util.Collections; public class DockerfileVariablesProvider implements EnvironmentVariablesProvider { - @NotNull @Override - public FileAcceptResult acceptFile(VirtualFile file) { + public @NotNull FileAcceptResult acceptFile(VirtualFile file) { return file.getFileType().equals(DockerFileType.DOCKER_FILE_TYPE) ? FileAcceptResult.ACCEPTED : FileAcceptResult.NOT_ACCEPTED; } - @NotNull @Override - public Collection getElements(PsiFile psiFile) { + public @NotNull Collection getElements(PsiFile psiFile) { if(psiFile instanceof DockerPsiFile) { DockerfilePsiElementsVisitor visitor = new DockerfilePsiElementsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvCompletionProvider.java b/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvCompletionProvider.java index 79ca108864cb..ce7bf15cebe1 100644 --- a/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvCompletionProvider.java +++ b/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvCompletionProvider.java @@ -39,9 +39,8 @@ public class GoEnvCompletionProvider extends BaseEnvCompletionProvider implement }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; } @@ -55,8 +54,7 @@ public class GoEnvCompletionProvider extends BaseEnvCompletionProvider implement return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), stringLiteral.getDecodedText()); } - @Nullable - private GoStringLiteral getStringLiteral(@NotNull PsiElement psiElement) { + private @Nullable GoStringLiteral getStringLiteral(@NotNull PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof GoStringLiteral)) { @@ -76,9 +74,8 @@ public class GoEnvCompletionProvider extends BaseEnvCompletionProvider implement return null; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentCallsVisitor.java b/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentCallsVisitor.java index 2946097ce364..b22fc5ad8d95 100644 --- a/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentCallsVisitor.java +++ b/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentCallsVisitor.java @@ -3,7 +3,6 @@ package ru.adelf.idea.dotenv.go; import com.goide.psi.GoCallExpr; import com.goide.psi.GoStringLiteral; import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiRecursiveElementVisitor; import com.intellij.psi.PsiRecursiveElementWalkingVisitor; import org.jetbrains.annotations.NotNull; import ru.adelf.idea.dotenv.models.KeyUsagePsiElement; @@ -12,7 +11,7 @@ import java.util.Collection; import java.util.HashSet; class GoEnvironmentCallsVisitor extends PsiRecursiveElementWalkingVisitor { - final private Collection collectedItems = new HashSet<>(); + private final Collection collectedItems = new HashSet<>(); @Override public void visitElement(PsiElement element) { diff --git a/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentVariablesUsagesProvider.java index d5eaf2c13b99..af8341c9b95f 100644 --- a/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/go/src/ru/adelf/idea/dotenv/go/GoEnvironmentVariablesUsagesProvider.java @@ -17,9 +17,8 @@ public class GoEnvironmentVariablesUsagesProvider implements EnvironmentVariable return file.getFileType().equals(GoFileType.INSTANCE); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if(psiFile instanceof GoFile) { GoEnvironmentCallsVisitor visitor = new GoEnvironmentCallsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaCompletionConfidence.java b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaCompletionConfidence.java index 704af01ed376..a45fd6e7cb8c 100644 --- a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaCompletionConfidence.java +++ b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaCompletionConfidence.java @@ -8,9 +8,8 @@ import com.intellij.util.ThreeState; import org.jetbrains.annotations.NotNull; public class JavaCompletionConfidence extends CompletionConfidence { - @NotNull @Override - public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { + public @NotNull ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { PsiElement literal = contextElement.getContext(); if(!(literal instanceof PsiLiteralExpression)) { return ThreeState.UNSURE; diff --git a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvCompletionContributor.java b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvCompletionContributor.java index 2d809c59c2dd..b8dbfc005a71 100644 --- a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvCompletionContributor.java +++ b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvCompletionContributor.java @@ -37,9 +37,8 @@ public class JavaEnvCompletionContributor extends BaseEnvCompletionProvider impl }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; } @@ -59,8 +58,7 @@ public class JavaEnvCompletionContributor extends BaseEnvCompletionProvider impl return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), (String) value); } - @Nullable - private PsiLiteralExpression getStringLiteral(@NotNull PsiElement psiElement) { + private @Nullable PsiLiteralExpression getStringLiteral(@NotNull PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof PsiLiteralExpression)) { @@ -74,9 +72,8 @@ public class JavaEnvCompletionContributor extends BaseEnvCompletionProvider impl return (PsiLiteralExpression) parent; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentCallsVisitor.java b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentCallsVisitor.java index e10d9cdef836..b24813c63a93 100644 --- a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentCallsVisitor.java +++ b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentCallsVisitor.java @@ -11,7 +11,7 @@ import java.util.Collection; import java.util.HashSet; class JavaEnvironmentCallsVisitor extends JavaRecursiveElementWalkingVisitor { - final private Collection collectedItems = new HashSet<>(); + private final Collection collectedItems = new HashSet<>(); @Override public void visitMethodCallExpression(PsiMethodCallExpression expression) { diff --git a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentClasses.java b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentClasses.java index 8182a0be4f2a..115d8ce88268 100644 --- a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentClasses.java +++ b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentClasses.java @@ -11,8 +11,7 @@ public class JavaEnvironmentClasses { return methodName.equals("getenv") || methodName.equals("getEnv"); } - @Nullable - public static List getClassNames(String methodName) { + public static @Nullable List getClassNames(String methodName) { return switch (methodName) { case "get" -> Arrays.asList("Dotenv", "DotEnv"); case "getProperty" -> Collections.singletonList("System"); diff --git a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentVariablesUsagesProvider.java index d45a39e7c63e..24cfe8ae45ef 100644 --- a/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/java/src/ru/adelf/idea/dotenv/java/JavaEnvironmentVariablesUsagesProvider.java @@ -17,9 +17,8 @@ public class JavaEnvironmentVariablesUsagesProvider implements EnvironmentVariab return file.getFileType().equals(JavaFileType.INSTANCE); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if (psiFile instanceof PsiJavaFile) { JavaEnvironmentCallsVisitor visitor = new JavaEnvironmentCallsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinCompletionConfidence.java b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinCompletionConfidence.java index 37dfc7bb9802..4186e2c21eea 100644 --- a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinCompletionConfidence.java +++ b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinCompletionConfidence.java @@ -8,9 +8,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.psi.KtLiteralStringTemplateEntry; public class KotlinCompletionConfidence extends CompletionConfidence { - @NotNull @Override - public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { + public @NotNull ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) { PsiElement literal = contextElement.getContext(); if (!(literal instanceof KtLiteralStringTemplateEntry)) { return ThreeState.UNSURE; diff --git a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvCompletionContributor.java b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvCompletionContributor.java index aa196d23ead5..03c59e1abff8 100644 --- a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvCompletionContributor.java +++ b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvCompletionContributor.java @@ -37,9 +37,8 @@ public class KotlinEnvCompletionContributor extends BaseEnvCompletionProvider im }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; } @@ -53,8 +52,7 @@ public class KotlinEnvCompletionContributor extends BaseEnvCompletionProvider im return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), stringLiteral.getText()); } - @Nullable - private KtLiteralStringTemplateEntry getStringLiteral(@NotNull PsiElement psiElement) { + private @Nullable KtLiteralStringTemplateEntry getStringLiteral(@NotNull PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof KtLiteralStringTemplateEntry)) { @@ -68,9 +66,8 @@ public class KotlinEnvCompletionContributor extends BaseEnvCompletionProvider im return (KtLiteralStringTemplateEntry) parent; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvironmentVariablesUsagesProvider.java index aef733752a8f..db15d8107ec2 100644 --- a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinEnvironmentVariablesUsagesProvider.java @@ -19,9 +19,8 @@ public class KotlinEnvironmentVariablesUsagesProvider implements EnvironmentVari return file.getFileType().equals(KotlinFileType.INSTANCE); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if (psiFile instanceof KtFile) { Set result = new HashSet<>(); diff --git a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinPsiHelper.java b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinPsiHelper.java index 4c31eb7f8990..0b668fc93522 100644 --- a/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinPsiHelper.java +++ b/plugins/env-files-support/kotlin/src/ru/adelf/idea/dotenv/kotlin/KotlinPsiHelper.java @@ -90,8 +90,7 @@ class KotlinPsiHelper { return checkReferences(methodCallExpression.getCalleeExpression(), classNames); } - @Nullable - static KeyUsagePsiElement getKeyUsageFromCall(@NotNull KtCallExpression expression) { + static @Nullable KeyUsagePsiElement getKeyUsageFromCall(@NotNull KtCallExpression expression) { if (!isEnvMethodCall(expression)) { return null; } @@ -127,8 +126,7 @@ class KotlinPsiHelper { return checkReferences(arrayAccess, classNames); } - @Nullable - static KeyUsagePsiElement getKeyUsageFromArrayAccess(@NotNull KtArrayAccessExpression expression) { + static @Nullable KeyUsagePsiElement getKeyUsageFromArrayAccess(@NotNull KtArrayAccessExpression expression) { if (!isEnvArrayAccess(expression)) { return null; } @@ -142,8 +140,7 @@ class KotlinPsiHelper { return getKeyUsageFromStringTemplate(indexExpressions.get(0)); } - @Nullable - private static KeyUsagePsiElement getKeyUsageFromStringTemplate(PsiElement element) { + private static @Nullable KeyUsagePsiElement getKeyUsageFromStringTemplate(PsiElement element) { if (!(element instanceof KtStringTemplateExpression)) { return null; } diff --git a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvCompletionContributor.java b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvCompletionContributor.java index d012676bf0fa..37d450edafe2 100644 --- a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvCompletionContributor.java +++ b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvCompletionContributor.java @@ -38,9 +38,8 @@ public class PhpEnvCompletionContributor extends BaseEnvCompletionProvider imple }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; @@ -55,8 +54,7 @@ public class PhpEnvCompletionContributor extends BaseEnvCompletionProvider imple return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), stringLiteral.getContents()); } - @Nullable - private StringLiteralExpression getStringLiteral(@NotNull PsiElement psiElement) { + private @Nullable StringLiteralExpression getStringLiteral(@NotNull PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof StringLiteralExpression)) { @@ -70,9 +68,8 @@ public class PhpEnvCompletionContributor extends BaseEnvCompletionProvider imple return (StringLiteralExpression) parent; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentCallsVisitor.java b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentCallsVisitor.java index 3bb59637f40f..0f5ad9275fcd 100644 --- a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentCallsVisitor.java +++ b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentCallsVisitor.java @@ -13,7 +13,7 @@ import java.util.Collection; import java.util.HashSet; class PhpEnvironmentCallsVisitor extends PsiRecursiveElementVisitor { - final private Collection collectedItems = new HashSet<>(); + private final Collection collectedItems = new HashSet<>(); @Override public void visitElement(@NotNull PsiElement element) { diff --git a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentVariablesUsagesProvider.java index a4b63dbecac7..320cdde8616a 100644 --- a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpEnvironmentVariablesUsagesProvider.java @@ -17,9 +17,8 @@ public class PhpEnvironmentVariablesUsagesProvider implements EnvironmentVariabl return file.getFileType().equals(PhpFileType.INSTANCE); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if(psiFile instanceof PhpFile) { PhpEnvironmentCallsVisitor visitor = new PhpEnvironmentCallsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpFileTypeOverrider.java b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpFileTypeOverrider.java index 49da479556dd..27ee1b92b64f 100644 --- a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpFileTypeOverrider.java +++ b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpFileTypeOverrider.java @@ -9,9 +9,8 @@ import org.jetbrains.annotations.Nullable; @SuppressWarnings("UnstableApiUsage") public class PhpFileTypeOverrider implements FileTypeOverrider { - @Nullable @Override - public FileType getOverriddenFileType(@NotNull VirtualFile virtualFile) { + public @Nullable FileType getOverriddenFileType(@NotNull VirtualFile virtualFile) { if (virtualFile.getName().startsWith(".env") && virtualFile.getName().endsWith(".php")) { return PhpFileType.INSTANCE; } diff --git a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvCompletionContributor.java b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvCompletionContributor.java index 5cb961e349bd..e66653141ea0 100644 --- a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvCompletionContributor.java +++ b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvCompletionContributor.java @@ -46,9 +46,8 @@ public class PhpunitEnvCompletionContributor extends BaseEnvCompletionProvider i }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; @@ -63,8 +62,7 @@ public class PhpunitEnvCompletionContributor extends BaseEnvCompletionProvider i return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), stringLiteral.getValue()); } - @Nullable - private XmlAttributeValue getXmlAttributeValue(@NotNull PsiElement psiElement) { + private @Nullable XmlAttributeValue getXmlAttributeValue(@NotNull PsiElement psiElement) { PsiElement attributeValue = psiElement.getParent(); if (!(attributeValue instanceof XmlAttributeValue)) return null; @@ -86,9 +84,8 @@ public class PhpunitEnvCompletionContributor extends BaseEnvCompletionProvider i return (XmlAttributeValue) attributeValue; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvironmentVariablesUsagesProvider.java index 4e67fb6d1322..48e7deb865c3 100644 --- a/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/php/src/ru/adelf/idea/dotenv/php/PhpunitEnvironmentVariablesUsagesProvider.java @@ -21,9 +21,8 @@ public class PhpunitEnvironmentVariablesUsagesProvider implements EnvironmentVar return file.getFileType().equals(XmlFileType.INSTANCE) && file.getName().equals("phpunit.xml"); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if (!(psiFile instanceof XmlFile)) return Collections.emptyList(); if (!(psiFile.getFirstChild() instanceof XmlDocument)) return Collections.emptyList(); diff --git a/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvCompletionProvider.java b/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvCompletionProvider.java index fcd7089c4b74..5599c00714b5 100644 --- a/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvCompletionProvider.java +++ b/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvCompletionProvider.java @@ -38,9 +38,8 @@ public class PythonEnvCompletionProvider extends BaseEnvCompletionProvider imple }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; @@ -55,8 +54,7 @@ public class PythonEnvCompletionProvider extends BaseEnvCompletionProvider imple return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), stringLiteral.getStringValue()); } - @Nullable - private PyStringLiteralExpression getStringLiteral(@NotNull PsiElement psiElement) { + private @Nullable PyStringLiteralExpression getStringLiteral(@NotNull PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof PyStringLiteralExpression)) { @@ -96,9 +94,8 @@ public class PythonEnvCompletionProvider extends BaseEnvCompletionProvider imple return null; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentCallsVisitor.java b/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentCallsVisitor.java index 57b89b432245..e8b20e0ec412 100644 --- a/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentCallsVisitor.java +++ b/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentCallsVisitor.java @@ -12,7 +12,7 @@ import java.util.Collection; import java.util.HashSet; class PythonEnvironmentCallsVisitor extends PsiRecursiveElementVisitor { - final private Collection collectedItems = new HashSet<>(); + private final Collection collectedItems = new HashSet<>(); @Override public void visitElement(PsiElement element) { diff --git a/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentVariablesUsagesProvider.java index 2248054aeb56..18bc532a42ab 100644 --- a/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/python/src/ru/adelf/idea/dotenv/python/PythonEnvironmentVariablesUsagesProvider.java @@ -17,9 +17,8 @@ public class PythonEnvironmentVariablesUsagesProvider implements EnvironmentVari return file.getFileType().equals(PythonFileType.INSTANCE); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if(psiFile instanceof PyFile) { PythonEnvironmentCallsVisitor visitor = new PythonEnvironmentCallsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvCompletionProvider.java b/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvCompletionProvider.java index 7156826970dc..b5beb8e864a7 100644 --- a/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvCompletionProvider.java +++ b/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvCompletionProvider.java @@ -42,9 +42,8 @@ public class RubyEnvCompletionProvider extends BaseEnvCompletionProvider impleme }); } - @Nullable @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { + public @Nullable PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) { if (psiElement == null) { return PsiElement.EMPTY_ARRAY; @@ -59,8 +58,7 @@ public class RubyEnvCompletionProvider extends BaseEnvCompletionProvider impleme return EnvironmentVariablesApi.getKeyDeclarations(psiElement.getProject(), stringLiteral.getContent()); } - @Nullable - private RStringLiteral getStringLiteral(@NotNull PsiElement psiElement) { + private @Nullable RStringLiteral getStringLiteral(@NotNull PsiElement psiElement) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof RStringLiteral)) { @@ -94,9 +92,8 @@ public class RubyEnvCompletionProvider extends BaseEnvCompletionProvider impleme return (RStringLiteral) parent; } - @Nullable @Override - public String getActionText(@NotNull DataContext dataContext) { + public @Nullable String getActionText(@NotNull DataContext dataContext) { return null; } } diff --git a/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentCallsVisitor.java b/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentCallsVisitor.java index 97fc46b1d353..42716ccd96b6 100644 --- a/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentCallsVisitor.java +++ b/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentCallsVisitor.java @@ -13,7 +13,7 @@ import java.util.HashSet; import java.util.Objects; class RubyEnvironmentCallsVisitor extends PsiRecursiveElementVisitor { - final private Collection collectedItems = new HashSet<>(); + private final Collection collectedItems = new HashSet<>(); @Override public void visitElement(PsiElement element) { diff --git a/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentVariablesUsagesProvider.java b/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentVariablesUsagesProvider.java index b89c632212af..0efb9f498124 100644 --- a/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentVariablesUsagesProvider.java +++ b/plugins/env-files-support/ruby/src/ru/adelf/idea/dotenv/ruby/RubyEnvironmentVariablesUsagesProvider.java @@ -17,9 +17,8 @@ public class RubyEnvironmentVariablesUsagesProvider implements EnvironmentVariab return file.getFileType().equals(RubyFileType.RUBY); } - @NotNull @Override - public Collection getUsages(PsiFile psiFile) { + public @NotNull Collection getUsages(PsiFile psiFile) { if(psiFile instanceof RFile) { RubyEnvironmentCallsVisitor visitor = new RubyEnvironmentCallsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFactory.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFactory.java index 347ebf7ea400..084edf0541c0 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFactory.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFactory.java @@ -32,8 +32,7 @@ public class DotEnvFactory { return ret.get(); } - @NotNull - private static PsiFile createDummyFile(Project project, String fileText) { + private static @NotNull PsiFile createDummyFile(Project project, String fileText) { return PsiFileFactory.getInstance(project).createFileFromText("DUMMY__.env", DotEnvFileType.INSTANCE, fileText, System.currentTimeMillis(), false); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFileType.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFileType.java index df5bc143a9db..6139404ea523 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFileType.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvFileType.java @@ -14,27 +14,23 @@ public class DotEnvFileType extends LanguageFileType { super(DotEnvLanguage.INSTANCE); } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return ".env file"; } - @NotNull @Override - public String getDescription() { + public @NotNull String getDescription() { return DotEnvBundle.message("label.env.file"); } - @NotNull @Override - public String getDefaultExtension() { + public @NotNull String getDefaultExtension() { return "env"; } - @Nullable @Override - public Icon getIcon() { + public @Nullable Icon getIcon() { return AllIcons.FileTypes.Text; } } \ No newline at end of file diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvParserDefinition.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvParserDefinition.java index 15890db52201..8c9684bb6bf5 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvParserDefinition.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvParserDefinition.java @@ -1,46 +1,47 @@ package ru.adelf.idea.dotenv; -import com.intellij.lang.*; +import com.intellij.lang.ASTNode; +import com.intellij.lang.ParserDefinition; +import com.intellij.lang.PsiParser; import com.intellij.lexer.Lexer; import com.intellij.openapi.project.Project; -import com.intellij.psi.*; -import com.intellij.psi.tree.*; +import com.intellij.psi.FileViewProvider; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.tree.IFileElementType; +import com.intellij.psi.tree.TokenSet; +import org.jetbrains.annotations.NotNull; import ru.adelf.idea.dotenv.grammars.DotEnvLexerAdapter; import ru.adelf.idea.dotenv.parser.DotEnvParser; -import ru.adelf.idea.dotenv.psi.*; -import org.jetbrains.annotations.NotNull; +import ru.adelf.idea.dotenv.psi.DotEnvFile; +import ru.adelf.idea.dotenv.psi.DotEnvTypes; public class DotEnvParserDefinition implements ParserDefinition { private static final TokenSet WHITE_SPACES = TokenSet.WHITE_SPACE; private static final IFileElementType FILE = new IFileElementType(DotEnvLanguage.INSTANCE); - @NotNull @Override - public Lexer createLexer(Project project) { + public @NotNull Lexer createLexer(Project project) { return new DotEnvLexerAdapter(); } @Override - @NotNull - public TokenSet getWhitespaceTokens() { + public @NotNull TokenSet getWhitespaceTokens() { return WHITE_SPACES; } @Override - @NotNull - public TokenSet getCommentTokens() { + public @NotNull TokenSet getCommentTokens() { return TokenSet.create(DotEnvTypes.COMMENT); } @Override - @NotNull - public TokenSet getStringLiteralElements() { + public @NotNull TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } @Override - @NotNull - public PsiParser createParser(final Project project) { + public @NotNull PsiParser createParser(final Project project) { return new DotEnvParser(); } @@ -60,8 +61,7 @@ public class DotEnvParserDefinition implements ParserDefinition { } @Override - @NotNull - public PsiElement createElement(ASTNode node) { + public @NotNull PsiElement createElement(ASTNode node) { return DotEnvTypes.Factory.createElement(node); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSettings.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSettings.java index 765fc1d0903b..a622449fd819 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSettings.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSettings.java @@ -15,9 +15,8 @@ public class DotEnvSettings implements PersistentStateComponent public boolean hideValuesInTheFile = false; - @Nullable @Override - public DotEnvSettings getState() { + public @Nullable DotEnvSettings getState() { return this; } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighter.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighter.java index 1e5b245a6bd9..b71dffda47e4 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighter.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighter.java @@ -32,9 +32,8 @@ class DotEnvSyntaxHighlighter extends SyntaxHighlighterBase { private static final TextAttributesKey[] COMMENT_KEYS = new TextAttributesKey[]{COMMENT}; private static final TextAttributesKey[] EMPTY_KEYS = TextAttributesKey.EMPTY_ARRAY; - @NotNull @Override - public Lexer getHighlightingLexer() { + public @NotNull Lexer getHighlightingLexer() { return new DotEnvLexerAdapter(); } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighterFactory.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighterFactory.java index 2c80c9ead7f2..78dcfd866616 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighterFactory.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvSyntaxHighlighterFactory.java @@ -1,14 +1,14 @@ package ru.adelf.idea.dotenv; -import com.intellij.openapi.fileTypes.*; +import com.intellij.openapi.fileTypes.SyntaxHighlighter; +import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; public class DotEnvSyntaxHighlighterFactory extends SyntaxHighlighterFactory { - @NotNull @Override - public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { + public @NotNull SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { return new DotEnvSyntaxHighlighter(); } } \ No newline at end of file diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvVariablesProvider.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvVariablesProvider.java index fafc6c3aa279..4462f640df26 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvVariablesProvider.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/DotEnvVariablesProvider.java @@ -12,9 +12,8 @@ import java.util.Collection; import java.util.Collections; public class DotEnvVariablesProvider implements EnvironmentVariablesProvider { - @NotNull @Override - public FileAcceptResult acceptFile(VirtualFile file) { + public @NotNull FileAcceptResult acceptFile(VirtualFile file) { if(!file.getFileType().equals(DotEnvFileType.INSTANCE)) { return FileAcceptResult.NOT_ACCEPTED; } @@ -23,9 +22,8 @@ public class DotEnvVariablesProvider implements EnvironmentVariablesProvider { return file.getName().equals(".env") ? FileAcceptResult.ACCEPTED : FileAcceptResult.ACCEPTED_SECONDARY; } - @NotNull @Override - public Collection getElements(PsiFile psiFile) { + public @NotNull Collection getElements(PsiFile psiFile) { if(psiFile instanceof DotEnvFile) { DotEnvPsiElementsVisitor visitor = new DotEnvPsiElementsVisitor(); psiFile.acceptChildren(visitor); diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/EnvironmentVariablesApi.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/EnvironmentVariablesApi.java index f38414a6e02c..c2155c7b752b 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/EnvironmentVariablesApi.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/EnvironmentVariablesApi.java @@ -19,8 +19,7 @@ import java.util.*; public class EnvironmentVariablesApi { - @NotNull - public static Map getAllKeyValues(Project project) { + public static @NotNull Map getAllKeyValues(Project project) { FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance(); Map keyValues = new HashMap<>(); Map secondaryKeyValues = new HashMap<>(); @@ -76,8 +75,7 @@ public class EnvironmentVariablesApi { * @param key environment variable key * @return All key declarations, in .env files, Dockerfile, docker-compose.yml, etc */ - @NotNull - public static PsiElement[] getKeyDeclarations(Project project, String key) { + public static @NotNull PsiElement[] getKeyDeclarations(Project project, String key) { List targets = new ArrayList<>(); List secondaryTargets = new ArrayList<>(); @@ -107,8 +105,7 @@ public class EnvironmentVariablesApi { * @param key environment variable key * @return All key usages, like getenv('KEY') */ - @NotNull - public static PsiElement[] getKeyUsages(Project project, String key) { + public static @NotNull PsiElement[] getKeyUsages(Project project, String key) { List targets = new ArrayList<>(); PsiSearchHelper searchHelper = PsiSearchHelper.getInstance(project); diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/FileAcceptResult.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/FileAcceptResult.java index be2c9b364408..88838ee87334 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/FileAcceptResult.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/api/FileAcceptResult.java @@ -1,9 +1,9 @@ package ru.adelf.idea.dotenv.api; public class FileAcceptResult { - public final static FileAcceptResult ACCEPTED = new FileAcceptResult(true, true); - public final static FileAcceptResult NOT_ACCEPTED = new FileAcceptResult(false, true); - public final static FileAcceptResult ACCEPTED_SECONDARY = new FileAcceptResult(true, false); + public static final FileAcceptResult ACCEPTED = new FileAcceptResult(true, true); + public static final FileAcceptResult NOT_ACCEPTED = new FileAcceptResult(false, true); + public static final FileAcceptResult ACCEPTED_SECONDARY = new FileAcceptResult(true, false); private final boolean accepted; private final boolean primary; diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/common/BaseEnvCompletionProvider.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/common/BaseEnvCompletionProvider.java index 56dd736e03c1..3d5bd5704711 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/common/BaseEnvCompletionProvider.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/common/BaseEnvCompletionProvider.java @@ -11,7 +11,7 @@ import ru.adelf.idea.dotenv.api.EnvironmentVariablesApi; import java.util.Map; -abstract public class BaseEnvCompletionProvider extends CompletionContributor implements GotoDeclarationHandler { +public abstract class BaseEnvCompletionProvider extends CompletionContributor implements GotoDeclarationHandler { protected void fillCompletionResultSet(@NotNull CompletionResultSet completionResultSet, @NotNull Project project) { for (Map.Entry entry : EnvironmentVariablesApi.getAllKeyValues(project).entrySet()) { diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/extension/DotEnvCommenter.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/extension/DotEnvCommenter.java index 501a155fe255..a27015b43751 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/extension/DotEnvCommenter.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/extension/DotEnvCommenter.java @@ -38,18 +38,16 @@ public class DotEnvCommenter implements Commenter, SelfManagingCommenter implements Psi this.key = key; } - @NotNull @Override - public ResolveResult[] multiResolve(boolean incompleteCode) { + public @NotNull ResolveResult[] multiResolve(boolean incompleteCode) { final PsiElement[] elements = EnvironmentVariablesApi.getKeyDeclarations(myElement.getProject(), key); return Arrays.stream(elements) @@ -35,16 +34,14 @@ public class DotEnvReference extends PsiReferenceBase implements Psi .toArray(ResolveResult[]::new); } - @Nullable @Override - public PsiElement resolve() { + public @Nullable PsiElement resolve() { ResolveResult[] resolveResults = multiResolve(false); return resolveResults.length == 1 ? resolveResults[0].getElement() : null; } - @NotNull @Override - public Object[] getVariants() { + public @NotNull Object[] getVariants() { Project project = myElement.getProject(); final PsiElement[] elements = EnvironmentVariablesApi.getKeyDeclarations(project, key); diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/indexing/DotEnvKeyValuesIndex.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/indexing/DotEnvKeyValuesIndex.java index 66fbdb897108..5b23cdc814e4 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/indexing/DotEnvKeyValuesIndex.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/indexing/DotEnvKeyValuesIndex.java @@ -17,15 +17,13 @@ public class DotEnvKeyValuesIndex extends FileBasedIndexExtension KEY = ID.create("ru.adelf.idea.php.dotenv.keyValues"); - @NotNull @Override - public ID getName() { + public @NotNull ID getName() { return KEY; } - @NotNull @Override - public DataIndexer getIndexer() { + public @NotNull DataIndexer getIndexer() { return fileContent -> { final Map map = new HashMap<>(); @@ -45,21 +43,18 @@ public class DotEnvKeyValuesIndex extends FileBasedIndexExtension getKeyDescriptor() { + public @NotNull KeyDescriptor getKeyDescriptor() { return EnumeratorStringDescriptor.INSTANCE; } - @NotNull @Override - public DataExternalizer getValueExternalizer() { + public @NotNull DataExternalizer getValueExternalizer() { return EnumeratorStringDescriptor.INSTANCE; } - @NotNull @Override - public FileBasedIndex.InputFilter getInputFilter() { + public @NotNull FileBasedIndex.InputFilter getInputFilter() { return file -> { for (EnvironmentVariablesProvider provider : EnvironmentVariablesProviderUtil.getEnvVariablesProviders()) { if (provider.acceptFile(file).isAccepted()) return true; diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/DuplicateKeyInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/DuplicateKeyInspection.java index d17233728c91..3646909b1c73 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/DuplicateKeyInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/DuplicateKeyInspection.java @@ -21,9 +21,8 @@ import java.util.Set; public class DuplicateKeyInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.message.duplicate.key"); } @@ -32,9 +31,8 @@ public class DuplicateKeyInspection extends LocalInspectionTool { return true; } - @Nullable @Override - public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + public @Nullable ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if(!(file instanceof DotEnvFile)) { return null; } @@ -42,8 +40,7 @@ public class DuplicateKeyInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { DotEnvPsiElementsVisitor visitor = new DotEnvPsiElementsVisitor(); file.acceptChildren(visitor); diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/ExtraBlankLineInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/ExtraBlankLineInspection.java index ac6108a10e11..253800c21005 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/ExtraBlankLineInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/ExtraBlankLineInspection.java @@ -21,9 +21,8 @@ import java.util.regex.Pattern; public class ExtraBlankLineInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.extra.blank.line"); } @@ -41,8 +40,7 @@ public class ExtraBlankLineInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, PsiWhiteSpaceImpl.class).forEach(whiteSpace -> { @@ -65,9 +63,8 @@ public class ExtraBlankLineInspection extends LocalInspectionTool { private static class RemoveExtraBlankLineQuickFix implements LocalQuickFix { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return DotEnvBundle.message("intention.name.remove.extra.blank.line"); } @@ -85,8 +82,7 @@ public class ExtraBlankLineInspection extends LocalInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getName(); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/IncorrectDelimiterInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/IncorrectDelimiterInspection.java index a097a40ad5a2..c73a0311b8aa 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/IncorrectDelimiterInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/IncorrectDelimiterInspection.java @@ -18,9 +18,8 @@ import ru.adelf.idea.dotenv.psi.impl.DotEnvKeyImpl; public class IncorrectDelimiterInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.incorrect.delimiter"); } @@ -29,9 +28,8 @@ public class IncorrectDelimiterInspection extends LocalInspectionTool { return true; } - @Nullable @Override - public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + public @Nullable ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof DotEnvFile)) { return null; } @@ -39,8 +37,7 @@ public class IncorrectDelimiterInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, DotEnvKeyImpl.class).forEach(key -> { @@ -55,9 +52,8 @@ public class IncorrectDelimiterInspection extends LocalInspectionTool { private static class ReplaceDelimiterQuickFix implements LocalQuickFix { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return DotEnvBundle.message("intention.name.replace.delimiter"); } @@ -76,8 +72,7 @@ public class IncorrectDelimiterInspection extends LocalInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getName(); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LeadingCharacterInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LeadingCharacterInspection.java index a56b683a879b..e9bd133a3bf8 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LeadingCharacterInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LeadingCharacterInspection.java @@ -15,9 +15,8 @@ import ru.adelf.idea.dotenv.psi.DotEnvKey; public class LeadingCharacterInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.invalid.leading.character"); } @@ -30,8 +29,7 @@ public class LeadingCharacterInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, DotEnvKey.class).forEach(dotEnvKey -> { diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LowercaseKeyInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LowercaseKeyInspection.java index 7c8516521cd0..f6b7710d959f 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LowercaseKeyInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/LowercaseKeyInspection.java @@ -20,9 +20,8 @@ import java.util.Locale; public class LowercaseKeyInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.key.uses.lowercase.chars"); } @@ -35,8 +34,7 @@ public class LowercaseKeyInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, DotEnvKey.class).forEach(dotEnvKey -> { @@ -53,9 +51,8 @@ public class LowercaseKeyInspection extends LocalInspectionTool { private static class ForceUppercaseQuickFix implements LocalQuickFix { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return DotEnvBundle.message("intention.name.change.to.uppercase"); } @@ -74,8 +71,7 @@ public class LowercaseKeyInspection extends LocalInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getName(); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceAroundSeparatorInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceAroundSeparatorInspection.java index a68b521d14e0..2f0b7be81706 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceAroundSeparatorInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceAroundSeparatorInspection.java @@ -21,9 +21,8 @@ import java.util.regex.Pattern; public class SpaceAroundSeparatorInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.extra.spaces.surrounding"); } @@ -36,8 +35,7 @@ public class SpaceAroundSeparatorInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, DotEnvProperty.class).forEach(dotEnvProperty -> { @@ -62,9 +60,8 @@ public class SpaceAroundSeparatorInspection extends LocalInspectionTool { private static class RemoveSpaceAroundSeparatorQuickFix implements LocalQuickFix { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return DotEnvBundle.message("intention.name.remove.spaces.surrounding"); } @@ -89,8 +86,7 @@ public class SpaceAroundSeparatorInspection extends LocalInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getName(); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceInsideNonQuotedInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceInsideNonQuotedInspection.java index d44960167640..205a79905430 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceInsideNonQuotedInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/SpaceInsideNonQuotedInspection.java @@ -21,9 +21,8 @@ import java.util.stream.Stream; public class SpaceInsideNonQuotedInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.space.inside.non.quoted.value"); } @@ -43,8 +42,7 @@ public class SpaceInsideNonQuotedInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, DotEnvValue.class).forEach(dotEnvValue -> { @@ -63,9 +61,8 @@ public class SpaceInsideNonQuotedInspection extends LocalInspectionTool { private static class AddQuotesQuickFix implements LocalQuickFix { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return DotEnvBundle.message("intention.name.add.quotes"); } @@ -104,8 +101,7 @@ public class SpaceInsideNonQuotedInspection extends LocalInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getName(); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/TrailingWhitespaceInspection.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/TrailingWhitespaceInspection.java index 9030847f1228..7e5e2bcce737 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/TrailingWhitespaceInspection.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/inspections/TrailingWhitespaceInspection.java @@ -22,9 +22,8 @@ import ru.adelf.idea.dotenv.psi.impl.DotEnvValueImpl; public class TrailingWhitespaceInspection extends LocalInspectionTool { // Change the display name within the plugin.xml // This needs to be here as otherwise the tests will throw errors. - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return DotEnvBundle.message("inspection.name.value.has.trailing.whitespace"); } @@ -37,8 +36,7 @@ public class TrailingWhitespaceInspection extends LocalInspectionTool { return analyzeFile(file, manager, isOnTheFly).getResultsArray(); } - @NotNull - private static ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { + private static @NotNull ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); PsiTreeUtil.findChildrenOfType(file, DotEnvValue.class).forEach(dotEnvValue -> { @@ -65,9 +63,8 @@ public class TrailingWhitespaceInspection extends LocalInspectionTool { private static class RemoveTrailingWhitespaceQuickFix implements LocalQuickFix { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return DotEnvBundle.message("intention.name.remove.trailing.whitespace"); } @@ -91,8 +88,7 @@ public class TrailingWhitespaceInspection extends LocalInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getName(); } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/models/EnvironmentKeyValue.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/models/EnvironmentKeyValue.java index 172c16965e30..eb1ce3e798da 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/models/EnvironmentKeyValue.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/models/EnvironmentKeyValue.java @@ -15,13 +15,11 @@ public class EnvironmentKeyValue { this.value = value; } - @NotNull - public String getKey() { + public @NotNull String getKey() { return key; } - @NotNull - public String getValue() { + public @NotNull String getValue() { return value; } } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/psi/DotEnvFile.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/psi/DotEnvFile.java index 009512274707..2452ec4524b1 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/psi/DotEnvFile.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/psi/DotEnvFile.java @@ -3,8 +3,9 @@ package ru.adelf.idea.dotenv.psi; import com.intellij.extapi.psi.PsiFileBase; import com.intellij.openapi.fileTypes.FileType; import com.intellij.psi.FileViewProvider; -import ru.adelf.idea.dotenv.*; import org.jetbrains.annotations.NotNull; +import ru.adelf.idea.dotenv.DotEnvFileType; +import ru.adelf.idea.dotenv.DotEnvLanguage; import javax.swing.*; @@ -13,9 +14,8 @@ public class DotEnvFile extends PsiFileBase { super(viewProvider, DotEnvLanguage.INSTANCE); } - @NotNull @Override - public FileType getFileType() { + public @NotNull FileType getFileType() { return DotEnvFileType.INSTANCE; } diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/ui/DotEnvSettingsConfigurable.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/ui/DotEnvSettingsConfigurable.java index 5356bdb4687c..7478332edd12 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/ui/DotEnvSettingsConfigurable.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/ui/DotEnvSettingsConfigurable.java @@ -16,15 +16,13 @@ public class DotEnvSettingsConfigurable implements Configurable { private JCheckBox storeValuesCheckbox; private JCheckBox hideValuesCheckbox; - @Nls @Override - public String getDisplayName() { + public @Nls String getDisplayName() { return "DotEnv"; } - @Nullable @Override - public JComponent createComponent() { + public @Nullable JComponent createComponent() { DotEnvSettings settings = getSettings(); Border standardBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5); diff --git a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/util/EnvironmentVariablesUtil.java b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/util/EnvironmentVariablesUtil.java index 12d1084092e3..3da51bd777b5 100644 --- a/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/util/EnvironmentVariablesUtil.java +++ b/plugins/env-files-support/src/main/java/ru/adelf/idea/dotenv/util/EnvironmentVariablesUtil.java @@ -11,8 +11,7 @@ import java.util.Set; import java.util.stream.Collectors; public class EnvironmentVariablesUtil { - @NotNull - public static EnvironmentKeyValue getKeyValueFromString(@NotNull String s) { + public static @NotNull EnvironmentKeyValue getKeyValueFromString(@NotNull String s) { int pos = s.indexOf("="); if(pos == -1) { @@ -22,8 +21,7 @@ public class EnvironmentVariablesUtil { } } - @NotNull - public static String getKeyFromString(@NotNull String s) { + public static @NotNull String getKeyFromString(@NotNull String s) { int pos = s.indexOf("="); if(pos == -1) { @@ -33,13 +31,11 @@ public class EnvironmentVariablesUtil { } } - @NotNull - public static Set getElementsByKey(String key, Collection items) { + public static @NotNull Set getElementsByKey(String key, Collection items) { return items.stream().filter(item -> item.getKey().equals(key)).map(KeyValuePsiElement::getElement).collect(Collectors.toSet()); } - @NotNull - public static Set getUsagesElementsByKey(String key, Collection items) { + public static @NotNull Set getUsagesElementsByKey(String key, Collection items) { return items.stream().filter(item -> item.getKey().equals(key)).map(KeyUsagePsiElement::getElement).collect(Collectors.toSet()); } } diff --git a/plugins/gradle/java/src/codeInsight/actions/AddGradleDslPluginAction.java b/plugins/gradle/java/src/codeInsight/actions/AddGradleDslPluginAction.java index 40316fe0bb1e..182e4859480d 100644 --- a/plugins/gradle/java/src/codeInsight/actions/AddGradleDslPluginAction.java +++ b/plugins/gradle/java/src/codeInsight/actions/AddGradleDslPluginAction.java @@ -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 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 org.jetbrains.plugins.gradle.codeInsight.actions; import com.intellij.codeInsight.CodeInsightActionHandler; @@ -43,9 +43,8 @@ public class AddGradleDslPluginAction extends CodeInsightAction { myPlugins.sort(Comparator.comparing(p -> p.name())); } - @NotNull @Override - protected CodeInsightActionHandler getHandler() { + protected @NotNull CodeInsightActionHandler getHandler() { return new AddGradleDslPluginActionHandler(myPlugins); } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java index 8bde80177019..d3e784e0981d 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java @@ -399,8 +399,7 @@ public class ClassWriter { } } - @NotNull - private static AnnotationContainer collectAllAnnotations(@Nullable StructMember mt) { + private static @NotNull AnnotationContainer collectAllAnnotations(@Nullable StructMember mt) { AnnotationContainer result = new AnnotationContainer(new HashSet<>(), new HashSet<>()); if (mt == null) { return result; @@ -1088,8 +1087,7 @@ public class ClassWriter { record RecordConstructorContext(boolean hideConstructor, boolean compact) { } - @NotNull - private static List collectParameterAnnotations(StructMethod mt, Type type, int param) { + private static @NotNull List collectParameterAnnotations(StructMethod mt, Type type, int param) { List result = new ArrayList<>(); if (mt == null || type == null) return result; for (StructGeneralAttribute.Key key : StructGeneralAttribute.PARAMETER_ANNOTATION_ATTRIBUTES) { diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/DecompilerContext.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/DecompilerContext.java index 8968f4105bb3..e3dbfc09d760 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/DecompilerContext.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/DecompilerContext.java @@ -25,20 +25,13 @@ public class DecompilerContext { public static final String IN_CLASS_TYPE_PARAMS = "IN_CLASS_TYPE_PARAMS"; public static final String RENAMER_FACTORY = "RENAMER_FACTORY"; - @NotNull - private final Map properties; - @NotNull - private final IFernflowerLogger logger; - @NotNull - private final StructContext structContext; - @NotNull - private final ClassesProcessor classProcessor; - @Nullable - private final PoolInterceptor poolInterceptor; - @NotNull - private final CancellationManager cancellationManager; - @NotNull - private final IVariableNamingFactory renamerFactory; + private final @NotNull Map properties; + private final @NotNull IFernflowerLogger logger; + private final @NotNull StructContext structContext; + private final @NotNull ClassesProcessor classProcessor; + private final @Nullable PoolInterceptor poolInterceptor; + private final @NotNull CancellationManager cancellationManager; + private final @NotNull IVariableNamingFactory renamerFactory; private ImportCollector importCollector; private VarProcessor varProcessor; private CounterContainer counterContainer; diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java index f8ac4cedb8ce..be94781eb9bb 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. 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 org.jetbrains.java.decompiler.modules.decompiler; import org.jetbrains.annotations.NotNull; @@ -352,8 +352,7 @@ public class FinallyProcessor { } } - @NotNull - private static BasicBlock createHeadBlock(ControlFlowGraph graph, int value, int var, int bytecodeVersion, int storeLength) { + private static @NotNull BasicBlock createHeadBlock(ControlFlowGraph graph, int value, int var, int bytecodeVersion, int storeLength) { SimpleInstructionSequence seq = new SimpleInstructionSequence(); seq.addInstruction(Instruction.create(CodeConstants.opc_bipush, false, CodeConstants.GROUP_GENERAL, bytecodeVersion, new int[]{value}, 1), -1); seq.addInstruction(Instruction.create(CodeConstants.opc_istore, false, CodeConstants.GROUP_GENERAL, bytecodeVersion, new int[]{var}, storeLength), -1); diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/PatternHelper.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/PatternHelper.java index aaae1ecbda8e..1f5fbf0562bb 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/PatternHelper.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/PatternHelper.java @@ -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 org.jetbrains.java.decompiler.modules.decompiler; import org.jetbrains.annotations.NotNull; @@ -92,8 +92,7 @@ public final class PatternHelper { return actions; } - @Nullable - private static FunctionExprent findInstanceofExprent(@NotNull IfStatement ifStat) { + private static @Nullable FunctionExprent findInstanceofExprent(@NotNull IfStatement ifStat) { return ifStat.getHeadexprent().getAllExprents(true).stream() .filter(expr -> expr.type == Exprent.EXPRENT_FUNCTION).map(expr -> (FunctionExprent)expr) .filter(expr -> expr.getFuncType() == FunctionExprent.FUNCTION_INSTANCEOF) @@ -126,12 +125,11 @@ public final class PatternHelper { return null; } - @Nullable - static PatternVariableCandidate findNextPatternVarCandidate(@NotNull Statement ifBranch, - @NotNull VarExprent operand, - @NotNull ConstExprent checkType, - @NotNull VarTracker varTracker, - @NotNull Statement topLevelStatement) { + static @Nullable PatternVariableCandidate findNextPatternVarCandidate(@NotNull Statement ifBranch, + @NotNull VarExprent operand, + @NotNull ConstExprent checkType, + @NotNull VarTracker varTracker, + @NotNull Statement topLevelStatement) { if (ifBranch instanceof BasicBlockStatement) { //check that cast correct and get the last assignment @@ -162,11 +160,10 @@ public final class PatternHelper { return null; } - @Nullable - private static PatternVariableCandidate findSimpleCandidateFromIfStat(@NotNull Statement ifElseStat, - @NotNull VarExprent operand, - @NotNull ConstExprent checkType, - @NotNull Statement topLevelStatement) { + private static @Nullable PatternVariableCandidate findSimpleCandidateFromIfStat(@NotNull Statement ifElseStat, + @NotNull VarExprent operand, + @NotNull ConstExprent checkType, + @NotNull Statement topLevelStatement) { List ifElseExprents = ifElseStat.getExprents(); if (ifElseExprents==null || ifElseExprents.isEmpty() || ifElseExprents.get(0).type != Exprent.EXPRENT_ASSIGNMENT) return null; @@ -227,9 +224,8 @@ public final class PatternHelper { return findRecordPatternCandidate(parentSequenceStatement, varTracker); } - @Nullable - private static PatternVariableCandidate findRecordPatternCandidate(@NotNull Statement parent, - @NotNull VarTracker varTracker) { + private static @Nullable PatternVariableCandidate findRecordPatternCandidate(@NotNull Statement parent, + @NotNull VarTracker varTracker) { if (!(parent instanceof SequenceStatement)) { return null; } @@ -552,7 +548,7 @@ public final class PatternHelper { private final @NotNull Runnable cleaner; private final @NotNull Set usedIfStatement = new HashSet<>(); private final @NotNull Statement nextStatement; - @Nullable private Exprent guards; + private @Nullable Exprent guards; PatternVariableCandidate(@NotNull VarExprent varExprent, @NotNull Statement nextStatement, @@ -600,12 +596,9 @@ public final class PatternHelper { } static class VarTracker { - @NotNull - private RecordVarExprent root; - @NotNull - private final Map varRecordTracker = new HashMap<>(); - @NotNull - private final List varTempAssignmentTracker = new ArrayList<>(); + private @NotNull RecordVarExprent root; + private final @NotNull Map varRecordTracker = new HashMap<>(); + private final @NotNull List varTempAssignmentTracker = new ArrayList<>(); VarTracker(@NotNull RecordVarExprent root) { this.root = root; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java index 2c5beaee5e5c..a2ba8a82053d 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 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 org.jetbrains.java.decompiler.modules.decompiler; import org.jetbrains.annotations.NotNull; @@ -141,9 +141,8 @@ public final class SwitchHelper { } } - @NotNull - private static Map evaluateCaseLabelsToFieldsMapping(@NotNull List> caseValues, - @NotNull ArrayExprent array) { + private static @NotNull Map evaluateCaseLabelsToFieldsMapping(@NotNull List> caseValues, + @NotNull ArrayExprent array) { Map mapping = new HashMap<>(caseValues.size()); if (array.getArray().type == Exprent.EXPRENT_FIELD) { // Javac compiler FieldExprent arrayField = (FieldExprent)array.getArray(); @@ -186,9 +185,8 @@ public final class SwitchHelper { return mapping; } - @Nullable - private static List> findRealCaseValues(@NotNull List> caseValues, - @NotNull Map mapping) { + private static @Nullable List> findRealCaseValues(@NotNull List> caseValues, + @NotNull Map mapping) { List> result = new ArrayList<>(caseValues.size()); for (List caseValue : caseValues) { List<@Nullable Exprent> values = new ArrayList<>(caseValue.size()); @@ -371,8 +369,7 @@ public final class SwitchHelper { private abstract static class StringSwitchRecognizer implements SwitchRecognizer { @Override - @Nullable - public abstract SwitchOnStringCandidate recognize(@NotNull SwitchStatement statement, @NotNull InvocationExprent switchSelector); + public abstract @Nullable SwitchOnStringCandidate recognize(@NotNull SwitchStatement statement, @NotNull InvocationExprent switchSelector); @NotNull Set findRealCaseValuesHashCodes(@NotNull SwitchStatement switchStatement) { @@ -430,9 +427,8 @@ public final class SwitchHelper { * @return recognized a switch candidate * see Lower.visitStringSwitch(JCTree.JCSwitch) in javac */ - @Nullable @Override - public SwitchOnStringCandidate recognize(@NotNull SwitchStatement firstSwitch, + public @Nullable SwitchOnStringCandidate recognize(@NotNull SwitchStatement firstSwitch, @NotNull InvocationExprent switchSelector) { if (switchSelector.getInstance() == null || switchSelector.getInstance().type != Exprent.EXPRENT_VAR) return null; if (!switchSelector.isInstanceCall(ClassNameConstants.JAVA_LANG_STRING, "hashCode", 0)) return null; @@ -500,9 +496,8 @@ public final class SwitchHelper { } private static class EcjStringRecognizer extends StringSwitchRecognizer { - @Nullable @Override - public SwitchOnStringCandidate recognize(@NotNull SwitchStatement switchStatement, @NotNull InvocationExprent switchSelector) { + public @Nullable SwitchOnStringCandidate recognize(@NotNull SwitchStatement switchStatement, @NotNull InvocationExprent switchSelector) { if (!switchSelector.isInstanceCall(ClassNameConstants.JAVA_LANG_STRING, "hashCode", 0)) return null; Set realCaseValueHashCodes = findRealCaseValuesHashCodes(switchStatement); Exprent switchSelectorQualifier = switchSelector.getInstance(); @@ -561,11 +556,10 @@ public final class SwitchHelper { } private abstract static class SwitchOnStringCandidate implements SwitchOnCandidate { - @Nullable - private static AssignmentExprent addTempVarAssignment(@NotNull Exprent exprent, - @NotNull VarExprent varExprent, - @NotNull Statement statement, - @NotNull List tempVarAssignments) { + private static @Nullable AssignmentExprent addTempVarAssignment(@NotNull Exprent exprent, + @NotNull VarExprent varExprent, + @NotNull Statement statement, + @NotNull List tempVarAssignments) { if (exprent.type != Exprent.EXPRENT_ASSIGNMENT) return null; AssignmentExprent assignment = (AssignmentExprent)exprent; if (!varExprent.isDefinition() && varExprent.equals(assignment.getLeft())) { @@ -576,16 +570,16 @@ public final class SwitchHelper { } private static class JavacSwitchCandidate extends SwitchOnStringCandidate { - @NotNull private final SwitchStatement firstSwitch; - @NotNull private final SwitchStatement secondSwitch; - @NotNull private final VarExprent firstSwitchSelector; - @NotNull private final Exprent secondSwitchSelector; - @NotNull private final VarExprent tmpVarInFirstSwitch; - @NotNull private final Map mappedCaseLabelValues; - @NotNull private final List firstSwitchExprents; - @NotNull private final Statement firstStatementInSecondSwitch; - @NotNull private final NewSelector newSelector; - @NotNull private final List tempVarAssignments = new ArrayList<>(); + private final @NotNull SwitchStatement firstSwitch; + private final @NotNull SwitchStatement secondSwitch; + private final @NotNull VarExprent firstSwitchSelector; + private final @NotNull Exprent secondSwitchSelector; + private final @NotNull VarExprent tmpVarInFirstSwitch; + private final @NotNull Map mappedCaseLabelValues; + private final @NotNull List firstSwitchExprents; + private final @NotNull Statement firstStatementInSecondSwitch; + private final @NotNull NewSelector newSelector; + private final @NotNull List tempVarAssignments = new ArrayList<>(); JavacSwitchCandidate(@NotNull SwitchStatement firstSwitch, @NotNull VarExprent firstSwitchSelector, @@ -652,8 +646,7 @@ public final class SwitchHelper { return Set.of(firstSwitch, secondSwitch); } - @NotNull - private NewSelector getSelector(@NotNull List tempVarAssignments, List firstSwitchExprents) { + private @NotNull NewSelector getSelector(@NotNull List tempVarAssignments, List firstSwitchExprents) { int lastExprentIndex = firstSwitchExprents.size(); if (lastExprentIndex > 0) { AssignmentExprent assignment = addTempVarAssignment(firstSwitchExprents.get(lastExprentIndex - 1), tmpVarInFirstSwitch, @@ -684,11 +677,11 @@ public final class SwitchHelper { } private static class EcjSwitchCandidate extends SwitchOnStringCandidate { - @NotNull private final SwitchStatement switchStatement; - @NotNull private final Exprent switchSelector; - @NotNull private final Map mappedIfStatements; - @NotNull private final Map mappedCaseLabelValues; - @NotNull private final List tempVarAssignments = new ArrayList<>(); + private final @NotNull SwitchStatement switchStatement; + private final @NotNull Exprent switchSelector; + private final @NotNull Map mappedIfStatements; + private final @NotNull Map mappedCaseLabelValues; + private final @NotNull List tempVarAssignments = new ArrayList<>(); private EcjSwitchCandidate(@NotNull SwitchStatement switchStatement, @NotNull Exprent switchSelector, diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternHelper.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternHelper.java index 8042cc16d1ed..05e22ba91370 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternHelper.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/SwitchPatternHelper.java @@ -1,4 +1,4 @@ -// Copyright 2000-2023 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 org.jetbrains.java.decompiler.modules.decompiler; import org.jetbrains.annotations.NotNull; @@ -99,24 +99,18 @@ public final class SwitchPatternHelper { /** * not null for nested switch */ - @Nullable - private final VarTracker myVarTracker; + private final @Nullable VarTracker myVarTracker; /** * Represents a set of type variables, which is used as second parameter in bootstrap call. */ - @NotNull - private final Set myTypeVars; - @NotNull - private final SwitchStatement myRootSwitchStatement; - @NotNull - private final InvocationExprent mySwitchSelector; + private final @NotNull Set myTypeVars; + private final @NotNull SwitchStatement myRootSwitchStatement; + private final @NotNull InvocationExprent mySwitchSelector; - @NotNull - private final List myTempVarAssignments = new ArrayList<>(); + private final @NotNull List myTempVarAssignments = new ArrayList<>(); - @NotNull - private final Set myUsedSwitch = new HashSet<>(); + private final @NotNull Set myUsedSwitch = new HashSet<>(); private JavacReferenceFinder(@Nullable VarTracker tracker, @NotNull Set typeVars, @@ -214,8 +208,7 @@ public final class SwitchPatternHelper { }); } - @NotNull - private SwitchPatternHelper.JavacReferenceFinder.Initializer findInitializer(@NotNull Root root, Exprent typeVar) { + private @NotNull SwitchPatternHelper.JavacReferenceFinder.Initializer findInitializer(@NotNull Root root, Exprent typeVar) { Exprent instance = Objects.requireNonNull(mySwitchSelector.getInstance()); Exprent nonNullCheck = null; @@ -263,8 +256,7 @@ public final class SwitchPatternHelper { * * @return The `Root` object representing the root `DoStatement` and expression statements, or null if not found. */ - @Nullable - private Root getRoot() { + private @Nullable Root getRoot() { Statement first = myRootSwitchStatement.getFirst(); if (first == null) { return null; @@ -428,8 +420,7 @@ public final class SwitchPatternHelper { return false; } - @Nullable - private static List resortForSwitchBootstrap(@NotNull SwitchStatement statement) { + private static @Nullable List resortForSwitchBootstrap(@NotNull SwitchStatement statement) { for (Statement caseStatement : statement.getCaseStatements()) { if (caseStatement == null) { return null; @@ -514,8 +505,7 @@ public final class SwitchPatternHelper { return sortedAll; } - @NotNull - private static VarExprent createDefaultPatternVal(@NotNull String className) { + private static @NotNull VarExprent createDefaultPatternVal(@NotNull String className) { VarProcessor processor = DecompilerContext.getVarProcessor(); VarExprent varExprent = new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER), new VarType(CodeConstants.TYPE_OBJECT, 0, className), @@ -528,8 +518,7 @@ public final class SwitchPatternHelper { /** * @return A map of case statements from switch and their pattern variable candidates, or null if the collection fails. */ - @Nullable - private Map> collectPatterns(@NotNull VarExprent instance, + private @Nullable Map> collectPatterns(@NotNull VarExprent instance, @Nullable DoStatement doStatement, @NotNull Set assignmentExprents) { @@ -659,8 +648,7 @@ public final class SwitchPatternHelper { * @param usedAssignments a set of used assignments * @return a PatternContainer object containing the collected guards */ - @NotNull - private SwitchPatternHelper.PatternContainer collectGuards(@NotNull Map> candidates, + private @NotNull SwitchPatternHelper.PatternContainer collectGuards(@NotNull Map> candidates, @NotNull Exprent typeVar, @Nullable Statement doParentStatement, @NotNull Set usedAssignments) { @@ -791,8 +779,7 @@ public final class SwitchPatternHelper { * @param assignmentExprent The AssignmentExprent to add (from last). * @return The normalized PatternVariableCandidate or null if normalization fails. */ - @Nullable - private PatternVariableCandidate normalizeCandidateWithBrokenEdges(@NotNull PatternVariableCandidate oldCandidate, + private @Nullable PatternVariableCandidate normalizeCandidateWithBrokenEdges(@NotNull PatternVariableCandidate oldCandidate, @NotNull SequenceStatement newSequence, @NotNull SequenceStatement previousSequenceStatement, @NotNull Statement last, @@ -884,8 +871,7 @@ public final class SwitchPatternHelper { * @return A list of pattern variable candidates or null, if it is impossible * List with only previousCandidate can be returned, if nested switch is not found */ - @Nullable - private List tryToFindNestedSwitch(@NotNull PatternVariableCandidate previousCandidate, + private @Nullable List tryToFindNestedSwitch(@NotNull PatternVariableCandidate previousCandidate, @NotNull Statement caseStatement, @NotNull Set usedAssignmentExprents, @NotNull VarTracker varTracker) { @@ -1107,8 +1093,7 @@ public final class SwitchPatternHelper { } } - @NotNull - private static Map getMapCaseClasses(List bootstrapArguments) { + private static @NotNull Map getMapCaseClasses(List bootstrapArguments) { Map mapCaseClasses = new HashMap<>(); for (int i = 0; i < bootstrapArguments.size(); i++) { PooledConstant constant = bootstrapArguments.get(i); @@ -1175,27 +1160,17 @@ public final class SwitchPatternHelper { * It can convert a usual switch statement to switch a statement with patterns. */ private static class SwitchOnReferenceCandidate implements SwitchOnCandidate { - @NotNull - private final SwitchStatement myRootSwitchStatement; - @NotNull - private final InvocationExprent myPreviousSelector; - @NotNull - private final Exprent myNewSwitchSelectorVariant; - @NotNull - private final List myTempVarAssignments; - @NotNull - private final List mySortedCasesFromRoot; + private final @NotNull SwitchStatement myRootSwitchStatement; + private final @NotNull InvocationExprent myPreviousSelector; + private final @NotNull Exprent myNewSwitchSelectorVariant; + private final @NotNull List myTempVarAssignments; + private final @NotNull List mySortedCasesFromRoot; - @NotNull - private final Set myUsedSwitchStatements; - @NotNull - private final Set myUsedTypeVarAssignments; - @Nullable - private final Runnable myCleaner; - @NotNull - private final SwitchPatternHelper.PatternContainer myPatternContainer; - @Nullable - private final DoStatement myUppedDoStatement; + private final @NotNull Set myUsedSwitchStatements; + private final @NotNull Set myUsedTypeVarAssignments; + private final @Nullable Runnable myCleaner; + private final @NotNull SwitchPatternHelper.PatternContainer myPatternContainer; + private final @Nullable DoStatement myUppedDoStatement; private final boolean myMustCleanNonNull; private SwitchOnReferenceCandidate(@NotNull SwitchStatement rootSwitchStatement, @@ -1278,8 +1253,7 @@ public final class SwitchPatternHelper { } } - @Nullable - private static Statement getStatementWithFirstAssignment(@NotNull Statement statement) { + private static @Nullable Statement getStatementWithFirstAssignment(@NotNull Statement statement) { if (statement.getExprents() != null && !statement.getExprents().isEmpty()) { if (statement.getExprents().get(0) instanceof AssignmentExprent) { return statement; @@ -1323,8 +1297,7 @@ public final class SwitchPatternHelper { return this.myTempVarAssignments; } - @NotNull - private Map getMapCaseValue(List bootstrapArguments) { + private @NotNull Map getMapCaseValue(List bootstrapArguments) { Map mapCaseValue = new HashMap<>(); for (int i = 0; i < bootstrapArguments.size(); i++) { PooledConstant constant = bootstrapArguments.get(i); diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/TryHelper.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/TryHelper.java index 474246917829..c2850f48dbf0 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/TryHelper.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/TryHelper.java @@ -552,8 +552,7 @@ public final class TryHelper } } - @Nullable - private static FunctionExprent unwrapNegations(@NotNull FunctionExprent func) { + private static @Nullable FunctionExprent unwrapNegations(@NotNull FunctionExprent func) { int count = 0; while (func.getFuncType() == FunctionExprent.FUNCTION_BOOL_NOT) { Exprent expr = func.getLstOperands().get(0); diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java index bad50a25b698..708ff7309b07 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java @@ -33,9 +33,8 @@ public class ArrayExprent extends Exprent { return new ArrayExprent(array.copy(), index.copy(), hardType, bytecode); } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { VarType exprType = array.getExprType(); if (exprType.equals(VarType.VARTYPE_NULL)) { return hardType.copy(); diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java index b6254ddda2ce..f25223d67851 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java @@ -47,9 +47,8 @@ public class AssignmentExprent extends Exprent { addBytecodeOffsets(bytecodeOffsets); } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { return left.getExprType(); } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java index a6bd8b694016..4c97969bcc93 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java @@ -126,8 +126,7 @@ public class ConstExprent extends Exprent { DOUBLE_CONSTANTS.put((double)Long.MIN_VALUE, "(double)Long.MIN_VALUE"); } - @NotNull - private VarType constType; + private @NotNull VarType constType; private final Object value; private final boolean boolPermitted; @@ -185,9 +184,8 @@ public class ConstExprent extends Exprent { return new ConstExprent(constType, value, bytecode); } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { return constType; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java index ea43a7052ead..0db7fb6a00a4 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java @@ -47,8 +47,7 @@ public abstract class Exprent implements IMatchable { public final int type; public final int id; - @Nullable - public BitSet bytecode = null; // offsets of bytecode instructions decompiled to this exprent + public @Nullable BitSet bytecode = null; // offsets of bytecode instructions decompiled to this exprent public Exprent(int type) { this.type = type; @@ -59,8 +58,7 @@ public abstract class Exprent implements IMatchable { return 0; // the highest precedence } - @NotNull - public VarType getExprType() { + public @NotNull VarType getExprType() { return VarType.VARTYPE_VOID; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java index 8a25a84706ac..60cd4f423eb4 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java @@ -30,8 +30,7 @@ public class FieldExprent extends Exprent { private final boolean isStatic; private Exprent instance; private final FieldDescriptor descriptor; - @Nullable - private VarType inferredType; + private @Nullable VarType inferredType; public FieldExprent(LinkConstant cn, Exprent instance, BitSet bytecodeOffsets) { this(cn.elementName, cn.className, instance == null, instance, FieldDescriptor.parseDescriptor(cn.descriptor), bytecodeOffsets); } @@ -47,9 +46,8 @@ public class FieldExprent extends Exprent { addBytecodeOffsets(bytecodeOffsets); } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { VarType variableType = inferredType; if (variableType == null) { VarType varType = descriptor.type; diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java index c401c433bbe0..bc8a357a2b02 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java @@ -38,40 +38,40 @@ public class FunctionExprent extends Exprent { public static final int FUNCTION_BOOL_NOT = 12; public static final int FUNCTION_NEG = 13; - public final static int FUNCTION_I2L = 14; - public final static int FUNCTION_I2F = 15; - public final static int FUNCTION_I2D = 16; - public final static int FUNCTION_L2I = 17; - public final static int FUNCTION_L2F = 18; - public final static int FUNCTION_L2D = 19; - public final static int FUNCTION_F2I = 20; - public final static int FUNCTION_F2L = 21; - public final static int FUNCTION_F2D = 22; - public final static int FUNCTION_D2I = 23; - public final static int FUNCTION_D2L = 24; - public final static int FUNCTION_D2F = 25; - public final static int FUNCTION_I2B = 26; - public final static int FUNCTION_I2C = 27; - public final static int FUNCTION_I2S = 28; + public static final int FUNCTION_I2L = 14; + public static final int FUNCTION_I2F = 15; + public static final int FUNCTION_I2D = 16; + public static final int FUNCTION_L2I = 17; + public static final int FUNCTION_L2F = 18; + public static final int FUNCTION_L2D = 19; + public static final int FUNCTION_F2I = 20; + public static final int FUNCTION_F2L = 21; + public static final int FUNCTION_F2D = 22; + public static final int FUNCTION_D2I = 23; + public static final int FUNCTION_D2L = 24; + public static final int FUNCTION_D2F = 25; + public static final int FUNCTION_I2B = 26; + public static final int FUNCTION_I2C = 27; + public static final int FUNCTION_I2S = 28; - public final static int FUNCTION_CAST = 29; - public final static int FUNCTION_INSTANCEOF = 30; + public static final int FUNCTION_CAST = 29; + public static final int FUNCTION_INSTANCEOF = 30; - public final static int FUNCTION_ARRAY_LENGTH = 31; + public static final int FUNCTION_ARRAY_LENGTH = 31; - public final static int FUNCTION_IMM = 32; - public final static int FUNCTION_MMI = 33; + public static final int FUNCTION_IMM = 32; + public static final int FUNCTION_MMI = 33; - public final static int FUNCTION_IPP = 34; - public final static int FUNCTION_PPI = 35; + public static final int FUNCTION_IPP = 34; + public static final int FUNCTION_PPI = 35; - public final static int FUNCTION_IIF = 36; + public static final int FUNCTION_IIF = 36; - public final static int FUNCTION_LCMP = 37; - public final static int FUNCTION_FCMPL = 38; - public final static int FUNCTION_FCMPG = 39; - public final static int FUNCTION_DCMPL = 40; - public final static int FUNCTION_DCMPG = 41; + public static final int FUNCTION_LCMP = 37; + public static final int FUNCTION_FCMPL = 38; + public static final int FUNCTION_FCMPG = 39; + public static final int FUNCTION_DCMPL = 40; + public static final int FUNCTION_DCMPG = 41; public static final int FUNCTION_EQ = 42; public static final int FUNCTION_NE = 43; @@ -187,8 +187,7 @@ public class FunctionExprent extends Exprent { private VarType implicitType; private final List lstOperands; private boolean needsCast = true; - @Nullable - private VarType inferredType; + private @Nullable VarType inferredType; public FunctionExprent(int funcType, ListStack stack, BitSet bytecodeOffsets) { this(funcType, new ArrayList<>(), bytecodeOffsets); @@ -219,9 +218,8 @@ public class FunctionExprent extends Exprent { lstOperands.add(operand); } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { if(inferredType != null) { return inferredType; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java index 5f0721111e37..eba6833be61d 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java @@ -60,8 +60,7 @@ public class InvocationExprent extends Exprent { private List parameters = new ArrayList<>(); private List bootstrapArguments; private List genericArgs = new ArrayList<>(); - @Nullable - private VarType inferredType; + private @Nullable VarType inferredType; public InvocationExprent() { super(EXPRENT_INVOCATION); } @@ -159,9 +158,8 @@ public class InvocationExprent extends Exprent { genericArgs = expr.genericArgs; } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { if (inferredType == null) { VarType ret = descriptor.ret; if (ret == null) { diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java index 2fbb30e8dc1d..a58fed29d3b6 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java @@ -35,8 +35,7 @@ public class NewExprent extends Exprent { private boolean methodReference = false; private boolean enumConst; private List genericArgs = new ArrayList<>(); - @Nullable - private VarType inferredType; + private @Nullable VarType inferredType; public NewExprent(VarType newType, ListStack stack, int arrayDim, BitSet bytecodeOffsets) { this(newType, getDimensions(arrayDim, stack), bytecodeOffsets); } @@ -70,9 +69,8 @@ public class NewExprent extends Exprent { return lstDims; } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { if (inferredType != null) { return inferredType; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/RecordVarExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/RecordVarExprent.java index 5193dbb6580d..886c5f50ae69 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/RecordVarExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/RecordVarExprent.java @@ -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 org.jetbrains.java.decompiler.modules.decompiler.exps; import org.jetbrains.annotations.NotNull; @@ -14,8 +14,7 @@ import java.util.List; */ public class RecordVarExprent extends VarExprent { - @NotNull - private final List components = new ArrayList<>(); + private final @NotNull List components = new ArrayList<>(); public RecordVarExprent(VarExprent v) { super(v.getIndex(), v.getVarType(), v.getProcessor()); @@ -95,8 +94,7 @@ public class RecordVarExprent extends VarExprent { * @param exprent the Exprent to match * @return the direct component of the RecordVarExprent that matches the provided Exprent, or null if no match is found */ - @Nullable - public RecordVarExprent getDirectComponent(@Nullable Exprent exprent) { + public @Nullable RecordVarExprent getDirectComponent(@Nullable Exprent exprent) { for (RecordVarExprent component : components) { if (component.equals(exprent)) { return component; diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java index 8f4aca3a2f20..b88353ef4725 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java @@ -42,9 +42,8 @@ public class SwitchExprent extends Exprent { return swExpr; } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { return value.getExprType(); } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index 5da3e55a06a2..dfeae5599987 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -49,8 +49,7 @@ public class VarExprent extends Exprent { private boolean classDef = false; private boolean stack = false; private LocalVariable lvtEntry = null; - @Nullable - private VarType inferredType = null; + private @Nullable VarType inferredType = null; private boolean insideLVT = false; public VarExprent(int index, VarType varType, VarProcessor processor) { @@ -65,9 +64,8 @@ public class VarExprent extends Exprent { this.addBytecodeOffsets(bytecode); } - @NotNull @Override - public VarType getExprType() { + public @NotNull VarType getExprType() { return getVarType(); } @@ -141,8 +139,7 @@ public class VarExprent extends Exprent { return bytecode == null ? -1 : bytecode.length(); } - @NotNull - public static String getName(VarVersion versionPair) { + public static @NotNull String getName(VarVersion versionPair) { return "var" + versionPair.var + (versionPair.version == 0 ? "" : "_" + versionPair.version); } @@ -242,8 +239,7 @@ public class VarExprent extends Exprent { this.insideLVT = insideLVT; } - @NotNull - public VarType getVarType() { + public @NotNull VarType getVarType() { if (inferredType != null) { return inferredType; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java index 49359f692862..82de784e97c6 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. 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 org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.annotations.Nullable; @@ -6,8 +6,7 @@ import org.jetbrains.annotations.Nullable; import java.util.BitSet; public class DummyExitStatement extends Statement { - @Nullable - public BitSet bytecode = null; // offsets of bytecode instructions mapped to dummy exit + public @Nullable BitSet bytecode = null; // offsets of bytecode instructions mapped to dummy exit public DummyExitStatement() { super(StatementType.DUMMY_EXIT); diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java index e68911b14a08..176864931526 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java @@ -452,8 +452,7 @@ public abstract class Statement implements IMatchable { return new ArrayList<>(stats); } - @NotNull - public List getExprentsOrSequentialObjects() { + public @NotNull List getExprentsOrSequentialObjects() { List exprents = getExprents(); if (exprents != null) { return exprents; @@ -816,8 +815,7 @@ public abstract class Statement implements IMatchable { * @return a list of {@link Exprent} objects representing expression statements (can be empty if BlockStatement is empty), * or null if it is a SequenceStatement or this Block is not processed */ - @Nullable - public List getExprents() { + public @Nullable List getExprents() { cancellationManager.checkCanceled(); return exprents; } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java index 06a0c34655d6..f86b17fac68b 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. 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 org.jetbrains.java.decompiler.modules.decompiler.stats; import org.jetbrains.annotations.NotNull; @@ -142,8 +142,7 @@ public final class SwitchStatement extends Statement { useCustomDefault = true; } - @Nullable - public static Statement isHead(@NotNull Statement head) { + public static @Nullable Statement isHead(@NotNull Statement head) { if (head.type == StatementType.BASIC_BLOCK && head.getLastBasicType() == StatementType.SWITCH) { List statements = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, statements)) { @@ -162,8 +161,7 @@ public final class SwitchStatement extends Statement { } @Override - @NotNull - public TextBuffer toJava(int indent, @NotNull BytecodeMappingTracer tracer) { + public @NotNull TextBuffer toJava(int indent, @NotNull BytecodeMappingTracer tracer) { SwitchHelper.simplifySwitchOnEnum(this); TextBuffer buf = new TextBuffer(); buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer)); @@ -261,8 +259,7 @@ public final class SwitchStatement extends Statement { } @Override - @NotNull - public List getSequentialObjects() { + public @NotNull List getSequentialObjects() { List result = new ArrayList<>(stats); result.add(1, headExprent); return result; @@ -286,8 +283,7 @@ public final class SwitchStatement extends Statement { } @Override - @NotNull - public Statement getSimpleCopy() { + public @NotNull Statement getSimpleCopy() { return new SwitchStatement(); } @@ -447,33 +443,27 @@ public final class SwitchStatement extends Statement { } } - @NotNull - public List getHeadExprentList() { + public @NotNull List getHeadExprentList() { return Collections.singletonList(headExprent); } - @Nullable - public Exprent getHeadExprent() { + public @Nullable Exprent getHeadExprent() { return headExprent; } - @NotNull - public List> getCaseEdges() { + public @NotNull List> getCaseEdges() { return caseEdges; } - @NotNull - public List getCaseStatements() { + public @NotNull List getCaseStatements() { return caseStatements; } - @NotNull - public StatEdge getDefaultEdge() { + public @NotNull StatEdge getDefaultEdge() { return defaultEdge; } - @NotNull - public List> getCaseValues() { + public @NotNull List> getCaseValues() { return caseValues; } } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/VarType.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/VarType.java index 1ab3777edbca..ff5686cc7363 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/VarType.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/VarType.java @@ -178,8 +178,7 @@ public class VarType implements Type { // TODO: optimize switch }; } - @NotNull - public VarType decreaseArrayDim() { + public @NotNull VarType decreaseArrayDim() { if (getArrayDim() > 0) { return new VarType(getType(), getArrayDim() - 1, getValue()); } diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java index d0c8e1a22e91..572e1699731d 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java @@ -228,9 +228,8 @@ public class GenericType extends VarType implements Type { return value.substring(0, index + 1); } - @NotNull @Override - public GenericType decreaseArrayDim() { + public @NotNull GenericType decreaseArrayDim() { assert getArrayDim() > 0 : this; return new GenericType(getType(), getArrayDim() - 1, getValue(), parent, arguments, wildcard); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/SuspiciousLocalesLanguagesInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/SuspiciousLocalesLanguagesInspection.java index 766794f324b0..1f67632aa128 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/SuspiciousLocalesLanguagesInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/SuspiciousLocalesLanguagesInspection.java @@ -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.codeInspection; import com.intellij.codeInspection.options.OptPane; @@ -28,7 +28,7 @@ import static com.intellij.codeInspection.options.OptPane.pane; public final class SuspiciousLocalesLanguagesInspection extends LocalInspectionTool { private static final String ADDITIONAL_LANGUAGES_ATTR_NAME = "additionalLanguages"; - private final static Supplier> JAVA_LOCALES = NotNullLazyValue.softLazy(() -> { + private static final Supplier> JAVA_LOCALES = NotNullLazyValue.softLazy(() -> { final Set result = new HashSet<>(); for (Locale locale : Locale.getAvailableLocales()) { result.add(locale.getLanguage()); diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java b/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java index 5b0371de838b..9bd101094ad6 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java @@ -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.codeInspection.capitalization; import com.intellij.codeInsight.AnnotationUtil; @@ -37,21 +37,18 @@ public final class AnnotateCapitalizationIntention implements IntentionAction { return true; } - @Nls - @NotNull @Override - public String getText() { + public @Nls @NotNull String getText() { return getFamilyName(); } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return JavaI18nBundle.message("intention.family.annotate.capitalization.type"); } @Override - public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { + public void invoke(final @NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { final PsiModifierListOwner modifierListOwner = getElement(editor, file); if (modifierListOwner == null) throw new IncorrectOperationException(); @@ -78,8 +75,7 @@ public final class AnnotateCapitalizationIntention implements IntentionAction { return false; } - @Nullable - private static PsiModifierListOwner getElement(Editor editor, PsiFile file) { + private static @Nullable PsiModifierListOwner getElement(Editor editor, PsiFile file) { PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); PsiParameter parameter = PsiTreeUtil.getParentOfType(element, PsiParameter.class, false); if (parameter == null) return null; diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java index 4222d473226b..e41f46b694ba 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/duplicateStringLiteral/DuplicateStringLiteralInspection.java @@ -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.codeInspection.duplicateStringLiteral; import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo; @@ -55,11 +55,10 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca @SuppressWarnings("WeakerAccess") public int MIN_STRING_LENGTH = 5; @SuppressWarnings("WeakerAccess") public boolean IGNORE_PROPERTY_KEYS; - @NonNls private static final String BR = "
"; + private static final @NonNls String BR = "
"; @Override - @NotNull - public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitReferenceExpression(final @NotNull PsiReferenceExpression expression) { @@ -74,13 +73,11 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca } @Override - @NotNull - public String getShortName() { + public @NotNull String getShortName() { return "DuplicateStringLiteralInspection"; } - @NotNull - private static List findDuplicateLiterals(@NotNull StringLiteralSearchQuery query, @NotNull Project project) { + private static @NotNull List findDuplicateLiterals(@NotNull StringLiteralSearchQuery query, @NotNull Project project) { final GlobalSearchScope scope = GlobalSearchScope.projectScope(project); final List words = ContainerUtil.filter(StringUtil.getWordsInStringLongestFirst(query.stringToFind), s -> s.length() >= query.minStringLength); if (words.isEmpty()) return Collections.emptyList(); @@ -114,8 +111,7 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca return foundExpressions; } - @NotNull - private static List findDuplicateLiteralsInFile(@NotNull String stringToFind, boolean ignorePropertyKeys, @NotNull PsiFile file) { + private static @NotNull List findDuplicateLiteralsInFile(@NotNull String stringToFind, boolean ignorePropertyKeys, @NotNull PsiFile file) { ProgressManager.checkCanceled(); CharSequence text = file.getViewProvider().getContents(); StringSearcher searcher = new StringSearcher(stringToFind, true, true); @@ -132,7 +128,7 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca return foundExpr; } - private void checkStringLiteralExpression(@NotNull final PsiLiteralExpression originalExpression, + private void checkStringLiteralExpression(final @NotNull PsiLiteralExpression originalExpression, @NotNull ProblemsHolder holder, final boolean isOnTheFly) { PsiExpression[] foundExpr = getDuplicateLiterals(holder.getProject(), originalExpression, isOnTheFly); @@ -222,8 +218,7 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca } } - @Nullable - private static PsiReferenceExpression createReferenceTo(@NotNull PsiField constant) throws IncorrectOperationException { + private static @Nullable PsiReferenceExpression createReferenceTo(@NotNull PsiField constant) throws IncorrectOperationException { PsiElementFactory factory = JavaPsiFacade.getInstance(constant.getProject()).getElementFactory(); PsiReferenceExpression reference = (PsiReferenceExpression)factory.createExpressionFromText("XXX." + constant.getName(), null); final PsiReferenceExpression classQualifier = (PsiReferenceExpression)reference.getQualifierExpression(); @@ -294,8 +289,7 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return JavaI18nBundle.message("inspection.duplicates.replace.family.quickfix"); } } @@ -338,16 +332,13 @@ public final class DuplicateStringLiteralInspection extends AbstractBaseJavaLoca }, JavaI18nBundle.message("introduce.constant.across.the.project")); } - @NotNull @Override - public String getText() { + public @NotNull String getText() { return getFamilyName(); } - @Nls - @NotNull @Override - public String getFamilyName() { + public @Nls @NotNull String getFamilyName() { return JavaI18nBundle.message("inspection.duplicates.navigate.to.occurrences"); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/AbstractI18nizeQuickFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/AbstractI18nizeQuickFix.java index 927f9feb2e0d..2619bfe62bd7 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/AbstractI18nizeQuickFix.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/AbstractI18nizeQuickFix.java @@ -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.codeInspection.i18n; import com.intellij.codeInsight.CodeInsightUtilCore; @@ -74,11 +74,11 @@ abstract class AbstractI18nizeQuickFix implements LocalQu } @Override - public final void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + public final void applyFix(final @NotNull Project project, final @NotNull ProblemDescriptor descriptor) { doFix(descriptor, project); } - abstract protected void doReplacement(@NotNull PsiFile psiFile, + protected abstract void doReplacement(@NotNull PsiFile psiFile, Editor editor, T literalExpression, String i18nizedText) throws IncorrectOperationException; @@ -113,8 +113,7 @@ abstract class AbstractI18nizeQuickFix implements LocalQu generationPlugin.replace(uElement, uElement, UElement.class); } - @NotNull - protected I18nizeQuickFixDialog.DialogCustomization getCustomization(String value) { + protected @NotNull I18nizeQuickFixDialog.DialogCustomization getCustomization(String value) { return new I18nizeQuickFixDialog.DialogCustomization(null, true, false, null, getSuggestedName(value, myInfo)); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/ConvertToBasicLatinInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/ConvertToBasicLatinInspection.java index 328f5e5ad272..f47b1d369dc2 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/ConvertToBasicLatinInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/ConvertToBasicLatinInspection.java @@ -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.codeInspection.i18n; import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool; @@ -32,9 +32,8 @@ import java.util.regex.Pattern; public final class ConvertToBasicLatinInspection extends AbstractBaseJavaLocalInspectionTool { - @NotNull @Override - public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { + public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { private void handle(@NotNull PsiElement element) { if (IOUtil.isAscii(element.getText())) return; @@ -94,8 +93,7 @@ public final class ConvertToBasicLatinInspection extends AbstractBaseJavaLocalIn protected abstract void convert(@NotNull StringBuilder sb, char ch); - @NotNull - protected abstract PsiElement buildReplacement(@NotNull PsiElementFactory factory, @NotNull PsiElement element, @NotNull String newText); + protected abstract @NotNull PsiElement buildReplacement(@NotNull PsiElementFactory factory, @NotNull PsiElement element, @NotNull String newText); } private static class LiteralHandler extends Handler { @@ -199,10 +197,8 @@ public final class ConvertToBasicLatinInspection extends AbstractBaseJavaLocalIn } private static class ConvertToBasicLatinFix extends PsiUpdateModCommandQuickFix { - @Nls - @NotNull @Override - public String getFamilyName() { + public @Nls @NotNull String getFamilyName() { return JavaI18nBundle.message("inspection.non.basic.latin.character.quickfix"); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java index 5263ee5bac99..cbccd568cf5a 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nInspection.java @@ -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.codeInspection.i18n; @@ -106,13 +106,13 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im private boolean reportUnannotatedReferences = false; public boolean ignoreAssignedToConstants; public boolean ignoreToString; - @NlsSafe private String nonNlsLiteralPattern; - @NlsSafe public String nonNlsCommentPattern; + private @NlsSafe String nonNlsLiteralPattern; + public @NlsSafe String nonNlsCommentPattern; private boolean ignoreForEnumConstants; - @Nullable private Pattern myCachedCommentPattern; - @Nullable private Pattern myCachedLiteralPattern; - @NonNls private static final String TO_STRING = "toString"; + private @Nullable Pattern myCachedCommentPattern; + private @Nullable Pattern myCachedLiteralPattern; + private static final @NonNls String TO_STRING = "toString"; public I18nInspection() { setNonNlsCommentPattern("NON-NLS"); @@ -194,14 +194,12 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im } @Override - @NotNull - public String getGroupDisplayName() { + public @NotNull String getGroupDisplayName() { return InspectionsBundle.message("group.names.internationalization.issues"); } @Override - @NotNull - public String getShortName() { + public @NotNull String getShortName() { return "HardCodedStringLiteral"; } @@ -279,8 +277,7 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im ); } - @NotNull - private static HtmlChunk exampleDescription(@NlsSafe String exampleText) { + private static @NotNull HtmlChunk exampleDescription(@NlsSafe String exampleText) { return HtmlChunk.fragment( HtmlChunk.text(JavaI18nBundle.message("tooltip.example")), HtmlChunk.br(), @@ -318,13 +315,11 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im return "nls"; } - @NotNull - private static LocalQuickFix createIntroduceConstantFix() { + private static @NotNull LocalQuickFix createIntroduceConstantFix() { return new IntroduceConstantFix(); } - @Nullable - private static ULocalVariable getVariableToSearch(UExpression passThrough) { + private static @Nullable ULocalVariable getVariableToSearch(UExpression passThrough) { UElement uastParent = passThrough.getUastParent(); ULocalVariable uVar = null; if (uastParent instanceof ULocalVariable) { @@ -346,9 +341,7 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im return uVar; } - @Nullable - @Unmodifiable - private static List<@NotNull UExpression> findUsages(UExpression passThrough, ULocalVariable uVar) { + private static @Nullable @Unmodifiable List<@NotNull UExpression> findUsages(UExpression passThrough, ULocalVariable uVar) { PsiElement psiVar = uVar.getSourcePsi(); PsiElement psi = passThrough.getSourcePsi(); if (psi != null && psiVar != null) { @@ -861,7 +854,7 @@ public final class I18nInspection extends AbstractBaseUastLocalInspectionTool im if (parent == null || !UastExpressionUtils.isMethodCall(parent)) { return false; } - @NonNls final String methodName = ((UCallExpression)parent).getMethodName(); + final @NonNls String methodName = ((UCallExpression)parent).getMethodName(); if (methodName == null) { return false; } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java index 2c8a96c872fd..9a896be1d0b6 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeAction.java @@ -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.codeInspection.i18n; import com.intellij.codeInsight.FileModificationService; @@ -48,8 +48,7 @@ public class I18nizeAction extends AnAction { } } - @Nullable - public static I18nQuickFixHandler getHandler(final AnActionEvent e) { + public static @Nullable I18nQuickFixHandler getHandler(final AnActionEvent e) { final Editor editor = getEditor(e); if (editor == null) return null; @@ -59,8 +58,7 @@ public class I18nizeAction extends AnAction { return getHandler(editor, psiFile); } - @Nullable - public static I18nQuickFixHandler getHandler(@NotNull Editor editor, @NotNull PsiFile psiFile) { + public static @Nullable I18nQuickFixHandler getHandler(@NotNull Editor editor, @NotNull PsiFile psiFile) { TextRange range = JavaI18nUtil.getSelectedRange(editor, psiFile); if (range == null) return null; @@ -90,8 +88,7 @@ public class I18nizeAction extends AnAction { return null; } - @Nullable - public static UInjectionHost getEnclosingStringLiteral(final PsiFile psiFile, final Editor editor) { + public static @Nullable UInjectionHost getEnclosingStringLiteral(final PsiFile psiFile, final Editor editor) { PsiElement psiElement = psiFile.findElementAt(editor.getCaretModel().getOffset()); return getEnclosingStringLiteral(psiElement); } @@ -100,8 +97,7 @@ public class I18nizeAction extends AnAction { * @param psiElement element to search from * @return UAST element representing an enclosing string literal */ - @Nullable - public static UInjectionHost getEnclosingStringLiteral(PsiElement psiElement) { + public static @Nullable UInjectionHost getEnclosingStringLiteral(PsiElement psiElement) { while (psiElement != null) { UInjectionHost uastStringLiteral = UastContextKt.toUElement(psiElement, UInjectionHost.class); if (uastStringLiteral != null && uastStringLiteral.isString()) { diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeBatchQuickFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeBatchQuickFix.java index c7f609c59569..2a3509a4b161 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeBatchQuickFix.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeBatchQuickFix.java @@ -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.codeInspection.i18n; import com.intellij.codeInspection.BatchQuickFix; @@ -237,8 +237,7 @@ public class I18nizeBatchQuickFix extends I18nizeQuickFix implements BatchQuickF return null; } - @Nullable - private static String suggestKeyByPlace(String value, @NotNull UExpression expression) { + private static @Nullable String suggestKeyByPlace(String value, @NotNull UExpression expression) { List usages = I18nInspection.findIndirectUsages(expression, true); if (usages.isEmpty()) { usages = Collections.singletonList(expression); diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java index 5e33c89a7370..a2eeeccd63df 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeConcatenationQuickFix.java @@ -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.codeInspection.i18n; import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo; @@ -29,7 +29,7 @@ import java.util.Map; import java.util.Objects; public class I18nizeConcatenationQuickFix extends AbstractI18nizeQuickFix { - @NonNls public static final String PARAMETERS_OPTION_KEY = "PARAMETERS"; + public static final @NonNls String PARAMETERS_OPTION_KEY = "PARAMETERS"; public I18nizeConcatenationQuickFix(NlsInfo.Localized info) { super(info); @@ -56,14 +56,13 @@ public class I18nizeConcatenationQuickFix extends AbstractI18nizeQuickFix(project, context, concatenation, formatString, getCustomization(formatString), true, true) { @Override - @Nullable - protected String getTemplateName() { + protected @Nullable String getTemplateName() { return myResourceBundleManager.getConcatenationTemplateName(); } @@ -127,8 +125,7 @@ public class I18nizeConcatenationQuickFix extends AbstractI18nizeQuickFix EP_NAME = ExtensionPointName.create("com.intellij.java-i18n.i18nizeHandlerProvider"); - @Nullable - public abstract I18nQuickFixHandler getHandler(@NotNull final PsiFile psiFile, @NotNull final Editor editor, @NotNull TextRange range); + public abstract @Nullable I18nQuickFixHandler getHandler(final @NotNull PsiFile psiFile, final @NotNull Editor editor, @NotNull TextRange range); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java index 1dfa5a8f834b..70508f8e3eda 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/I18nizeQuickFix.java @@ -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.codeInspection.i18n; import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo; @@ -45,8 +43,7 @@ public class I18nizeQuickFix extends AbstractI18nizeQuickFix { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return JavaI18nBundle.message("inspection.i18n.quickfix"); } @@ -136,11 +133,10 @@ public class I18nizeQuickFix extends AbstractI18nizeQuickFix { .br().append(HtmlChunk.text(string).code()).toFragment()); } - @Nullable - private static UBinaryExpression breakStringLiteral(@NotNull UInjectionHost literalExpression, - UastCodeGenerationPlugin generationPlugin, - UastElementFactory elementFactory, - int offset) throws IncorrectOperationException { + private static @Nullable UBinaryExpression breakStringLiteral(@NotNull UInjectionHost literalExpression, + UastCodeGenerationPlugin generationPlugin, + UastElementFactory elementFactory, + int offset) throws IncorrectOperationException { PsiElement sourcePsi = literalExpression.getSourcePsi(); if (sourcePsi == null) { return null; diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java index 261dfb2f6b7c..bc0b651a4764 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/InvalidPropertyKeyInspection.java @@ -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.codeInspection.i18n; import com.intellij.codeInsight.AnnotationUtil; @@ -28,8 +28,7 @@ import java.util.*; public final class InvalidPropertyKeyInspection extends AbstractBaseJavaLocalInspectionTool { @Override - @NotNull - public String getShortName() { + public @NotNull String getShortName() { return "UnresolvedPropertyKey"; } @@ -257,9 +256,8 @@ public final class InvalidPropertyKeyInspection extends AbstractBaseJavaLocalIns ); } - @NotNull - private static List filterNotInLibrary(@NotNull Project project, - @NotNull List propertiesFiles) { + private static @NotNull List filterNotInLibrary(@NotNull Project project, + @NotNull List propertiesFiles) { final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); final List result = new ArrayList<>(propertiesFiles.size()); diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaCreatePropertyFix.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaCreatePropertyFix.java index 95ae5c694eb5..d1bc0eae6b25 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaCreatePropertyFix.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaCreatePropertyFix.java @@ -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.codeInspection.i18n; import com.intellij.lang.properties.psi.PropertiesFile; @@ -69,13 +55,12 @@ public class JavaCreatePropertyFix extends CreatePropertyFix { return result; } - @Nullable - protected Couple invokeAction(@NotNull final Project project, - @NotNull PsiFile file, - @NotNull PsiElement psiElement, - @Nullable final String suggestedKey, - @Nullable String suggestedValue, - @Nullable final List propertiesFiles) { + protected @Nullable Couple invokeAction(final @NotNull Project project, + @NotNull PsiFile file, + @NotNull PsiElement psiElement, + final @Nullable String suggestedKey, + @Nullable String suggestedValue, + final @Nullable List propertiesFiles) { final PsiLiteralExpression literalExpression = psiElement instanceof PsiLiteralExpression ? (PsiLiteralExpression)psiElement : null; final String propertyValue = suggestedValue == null ? "" : suggestedValue; diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java index beb728d9d018..91bb39b30776 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java @@ -1,12 +1,12 @@ -// 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.codeInspection.i18n; import com.intellij.codeInsight.AnnotationUtil; import com.intellij.codeInsight.template.macro.MacroUtil; import com.intellij.codeInspection.restriction.AnnotationContext; import com.intellij.codeInspection.restriction.StringFlowUtil; -import com.intellij.lang.properties.ResourceBundle; import com.intellij.lang.properties.*; +import com.intellij.lang.properties.ResourceBundle; import com.intellij.lang.properties.psi.PropertiesFile; import com.intellij.lang.properties.psi.Property; import com.intellij.lang.properties.psi.PropertyCreationHandler; @@ -46,8 +46,7 @@ public final class JavaI18nUtil { private JavaI18nUtil() { } - @Nullable - public static TextRange getSelectedRange(Editor editor, @NotNull PsiFile psiFile) { + public static @Nullable TextRange getSelectedRange(Editor editor, @NotNull PsiFile psiFile) { if (editor == null) return null; String selectedText = editor.getSelectionModel().getSelectedText(); if (selectedText != null) { @@ -85,8 +84,7 @@ public final class JavaI18nUtil { }); } - @NotNull - static UExpression getTopLevelExpression(@NotNull UExpression expression, boolean stopAtCall) { + static @NotNull UExpression getTopLevelExpression(@NotNull UExpression expression, boolean stopAtCall) { while (expression.getUastParent() instanceof UExpression parent) { if (parent instanceof UBlockExpression || parent instanceof UReturnExpression) { break; @@ -152,8 +150,7 @@ public final class JavaI18nUtil { return true; } - @Nullable - private static ResourceBundle resolveResourceBundleByKey(@NotNull final String key, @NotNull final Project project) { + private static @Nullable ResourceBundle resolveResourceBundleByKey(final @NotNull String key, final @NotNull Project project) { final Ref bundleRef = Ref.create(); final boolean r = PropertiesReferenceManager.getInstance(project).processAllPropertiesFiles((baseName, propertiesFile) -> { if (propertiesFile.findPropertyByKey(key) != null) { @@ -225,7 +222,7 @@ public final class JavaI18nUtil { * * @return number of parameters from single property or 0 for wrong format */ - public static int getPropertyValuePlaceholdersCount(@NotNull final String propertyValue) { + public static int getPropertyValuePlaceholdersCount(final @NotNull String propertyValue) { try { return countFormatParameters(new MessageFormat(propertyValue)); } @@ -258,7 +255,7 @@ public final class JavaI18nUtil { * @param expression i18n literal * @return number of parameters */ - public static int getPropertyValueParamsMaxCount(@NotNull final UExpression expression) { + public static int getPropertyValueParamsMaxCount(final @NotNull UExpression expression) { final SortedSet paramsCount = getPropertyValueParamsCount(expression, null); if (paramsCount.isEmpty()) { return -1; @@ -266,17 +263,15 @@ public final class JavaI18nUtil { return paramsCount.last(); } - @NotNull - static SortedSet getPropertyValueParamsCount(@NotNull final PsiExpression expression, - @Nullable final String resourceBundleName) { + static @NotNull SortedSet getPropertyValueParamsCount(final @NotNull PsiExpression expression, + final @Nullable String resourceBundleName) { UExpression uExpression = UastContextKt.toUElement(expression, UExpression.class); if (uExpression == null) return new TreeSet<>(); return getPropertyValueParamsCount(uExpression, resourceBundleName); } - @NotNull - private static SortedSet getPropertyValueParamsCount(@NotNull final UExpression expression, - @Nullable final String resourceBundleName) { + private static @NotNull SortedSet getPropertyValueParamsCount(final @NotNull UExpression expression, + final @Nullable String resourceBundleName) { final UInjectionHost injectionHost; if (expression instanceof UInjectionHost) { injectionHost = (UInjectionHost)expression; @@ -400,11 +395,10 @@ public final class JavaI18nUtil { return true; } - @NotNull - private static String getSideText(@NotNull List formatParameters, - @NotNull Project project, - UExpression expression, - boolean nested) { + private static @NotNull String getSideText(@NotNull List formatParameters, + @NotNull Project project, + UExpression expression, + boolean nested) { String elseStr; if (expression instanceof ULiteralExpression) { Object elseValue = ((ULiteralExpression)expression).getValue(); @@ -429,8 +423,7 @@ public final class JavaI18nUtil { return elseStr.replaceAll("([<>|#])", "'$1'"); } - @NotNull - static String composeParametersText(@NotNull List args) { + static @NotNull String composeParametersText(@NotNull List args) { return args.stream().map(UExpression::getSourcePsi).filter(Objects::nonNull).map(psi -> psi.getText()).collect(Collectors.joining(",")); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java index 5f41ef2b700d..f624bbabbc46 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nizeQuickFixDialog.java @@ -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.codeInspection.i18n; import com.intellij.codeInsight.intention.IntentionAction; @@ -67,13 +67,13 @@ public class JavaI18nizeQuickFixDialog extends I18nizeQui private final ExecutorService myExecutorPool = AppExecutorUtil.createBoundedApplicationPoolExecutor( "JavaI18nizeQuickFixDialog Executor Pool", AppExecutorUtil.getAppExecutorService(), 1); - @NonNls public static final String PROPERTY_KEY_OPTION_KEY = "PROPERTY_KEY"; - @NonNls public static final String RESOURCE_BUNDLE_OPTION_KEY = "RESOURCE_BUNDLE"; - @NonNls public static final String PROPERTY_VALUE_ATTR = "PROPERTY_VALUE"; + public static final @NonNls String PROPERTY_KEY_OPTION_KEY = "PROPERTY_KEY"; + public static final @NonNls String RESOURCE_BUNDLE_OPTION_KEY = "RESOURCE_BUNDLE"; + public static final @NonNls String PROPERTY_VALUE_ATTR = "PROPERTY_VALUE"; public JavaI18nizeQuickFixDialog(@NotNull Project project, - @NotNull final PsiFile context, - @Nullable final T literalExpression, + final @NotNull PsiFile context, + final @Nullable T literalExpression, @NotNull String defaultPropertyValue, DialogCustomization customization, final boolean showJavaCodeInfo, @@ -241,8 +241,7 @@ public class JavaI18nizeQuickFixDialog extends I18nizeQui super.somethingChanged(); } - @Nullable - protected String getTemplateName() { + protected @Nullable String getTemplateName() { return myResourceBundleManager.getTemplateName(); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/NlsInfo.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/NlsInfo.java index 8a218b6bd73a..95bc36237e6a 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/NlsInfo.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/NlsInfo.java @@ -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 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.codeInspection.i18n; import com.intellij.codeInsight.AnnotationUtil; @@ -96,8 +96,7 @@ public abstract class NlsInfo implements RestrictionInfo { return fromAnnotationContext(expression.getUastParent(), context); } - @NotNull - private static NlsInfo fromEqualityCheck(@NotNull UExpression expression, boolean allowStringModifications) { + private static @NotNull NlsInfo fromEqualityCheck(@NotNull UExpression expression, boolean allowStringModifications) { UElement parent = UastUtils.skipParenthesizedExprUp(expression.getUastParent()); if (parent instanceof UCallExpression) { String name = ((UCallExpression)parent).getMethodName(); diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java index c5ff0fce80ee..ac0c09a73862 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/SuppressByCommentOutAction.java @@ -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.codeInspection.i18n; import com.intellij.analysis.AnalysisBundle; @@ -87,14 +73,12 @@ class SuppressByCommentOutAction extends SuppressIntentionAction { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return AnalysisBundle.message("suppress.inspection.family"); } - @NotNull @Override - public String getText() { + public @NotNull String getText() { return JavaI18nBundle.message("intention.text.suppress.with.0.comment", nonNlsCommentPattern); } } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/TitleCapitalizationInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/TitleCapitalizationInspection.java index d7bca8917ede..ffdd9d9cdd86 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/TitleCapitalizationInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/TitleCapitalizationInspection.java @@ -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.codeInspection.i18n; import com.ibm.icu.text.MessagePattern; @@ -28,9 +28,8 @@ import java.util.*; import java.util.stream.IntStream; public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalInspectionTool { - @NotNull @Override - public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { + public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { return new PsiElementVisitor() { @SuppressWarnings("unchecked") private static final Class[] uExpressionClasses = new Class[] @@ -108,8 +107,7 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn }; } - @Nullable - private static Value getTitleValue(@Nullable UExpression arg, @Nullable Set processed) { + private static @Nullable Value getTitleValue(@Nullable UExpression arg, @Nullable Set processed) { if (arg instanceof UInjectionHost) { return Value.of((UInjectionHost)arg); } @@ -147,8 +145,7 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn return null; } - @Nullable - private static Property getPropertyArgument(UCallExpression arg) { + private static @Nullable Property getPropertyArgument(UCallExpression arg) { List args = arg.getValueArguments(); if (!args.isEmpty()) { return JavaI18nUtil.resolveProperty(args.get(0)); @@ -165,9 +162,8 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn myCapitalization = capitalization; } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return JavaI18nBundle.message("quickfix.text.title.capitalization", myTitleValue); } @@ -212,9 +208,8 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn return null; } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return JavaI18nBundle.message("quickfix.family.title.capitalization.fix"); } } @@ -224,16 +219,14 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn @NotNull String toString(); boolean isSatisfied(@NotNull Nls.Capitalization capitalization); - @NotNull - default String fixCapitalization(@NotNull Nls.Capitalization capitalization) { + default @NotNull String fixCapitalization(@NotNull Nls.Capitalization capitalization) { return NlsCapitalizationUtil.fixValue(toString(), capitalization); } default boolean canFix() { return true; } @Contract("null, _ -> null") - @Nullable - static Value of(@Nullable Property property, boolean useFormat) { + static @Nullable Value of(@Nullable Property property, boolean useFormat) { if (property == null) return null; String value = property.getUnescapedValue(); if (value == null) return null; @@ -254,14 +247,12 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn return value == null ? null : new TextValue(value); } - @Nullable - static Value of(@NotNull PsiLiteralExpression literal) { + static @Nullable Value of(@NotNull PsiLiteralExpression literal) { Object value = literal.getValue(); return value instanceof String ? new TextValue((String)value) : null; } - @Nullable - static Value of(NlsInfo info) { + static @Nullable Value of(NlsInfo info) { if (info instanceof NlsInfo.Localized) { Nls.Capitalization capitalization = ((NlsInfo.Localized)info).getCapitalization(); if (capitalization != Nls.Capitalization.NotSpecified) { @@ -277,9 +268,8 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn TextValue(String text) { myText = text; } - @NotNull @Override - public String toString() { return myText;} + public @NotNull String toString() { return myText;} @Override public boolean isSatisfied(@NotNull Nls.Capitalization capitalization) { @@ -304,9 +294,8 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn return false; } - @NotNull @Override - public String toString() { return getCapitalizationName(myDeclared);} + public @NotNull String toString() { return getCapitalizationName(myDeclared);} } static class PropertyValue implements Value { @@ -318,8 +307,8 @@ public final class TitleCapitalizationInspection extends AbstractBaseJavaLocalIn myPattern = pattern; } - @NotNull @Override - public String toString() { + @Override + public @NotNull String toString() { return myPresentation; } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/batch/I18nizeMultipleStringsDialog.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/batch/I18nizeMultipleStringsDialog.java index ae4d66879631..696776c11cca 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/batch/I18nizeMultipleStringsDialog.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/batch/I18nizeMultipleStringsDialog.java @@ -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 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.codeInspection.i18n.batch; import com.intellij.codeInspection.i18n.I18nizeConcatenationQuickFix; @@ -61,8 +61,8 @@ import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.io.IOException; -import java.util.List; import java.util.*; +import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; @@ -71,7 +71,7 @@ public final class I18nizeMultipleStringsDialog extends DialogWrapper { private static final @NonNls String LAST_USED_PROPERTIES_FILE = "LAST_USED_PROPERTIES_FILE"; private static final @NonNls String LAST_USED_CONTEXT = "I18N_FIX_LAST_USED_CONTEXT"; - @NotNull private final Project myProject; + private final @NotNull Project myProject; private final List> myKeyValuePairs; private final @NotNull Function> myUsagePreviewProvider; private final Set myContextModules; @@ -272,8 +272,7 @@ public final class I18nizeMultipleStringsDialog extends DialogWrapper { return splitter; } - @NotNull - private List>> getSelectedDataWithIndices() { + private @NotNull List>> getSelectedDataWithIndices() { int[] rows = myTable.getSelectedRows(); List>> selection = new ArrayList<>(rows.length); for (int row : rows) { @@ -305,8 +304,7 @@ public final class I18nizeMultipleStringsDialog extends DialogWrapper { super.doOKAction(); } - @Nullable - private String getContextString() { + private @Nullable String getContextString() { return myContextModules.stream().map(Module::getName).min(Comparator.naturalOrder()).orElse(null); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueAction.java index 553aea0b0bf8..35c73373f572 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueAction.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueAction.java @@ -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.codeInspection.i18n.folding; import com.intellij.codeInsight.folding.impl.EditorFoldingInfo; @@ -69,9 +69,8 @@ public final class EditPropertyValueAction extends BaseRefactoringAction { return false; } - @Nullable @Override - protected RefactoringActionHandler getHandler(@NotNull DataContext dataContext) { + protected @Nullable RefactoringActionHandler getHandler(@NotNull DataContext dataContext) { return new Handler(); } @@ -102,8 +101,7 @@ public final class EditPropertyValueAction extends BaseRefactoringAction { return getEditableElement(region) != null; } - @Nullable - public static PsiElement getEditableElement(@NotNull FoldRegion region) { + public static @Nullable PsiElement getEditableElement(@NotNull FoldRegion region) { PsiElement psiElement = EditorFoldingInfo.get(region.getEditor()).getPsiElement(region); return psiElement == null || psiElement.getUserData(EDITABLE_PROPERTY_VALUE) == null ? null : psiElement; } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueIntentionAction.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueIntentionAction.java index 5d99ab6f677e..1ee872748c3d 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueIntentionAction.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueIntentionAction.java @@ -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.codeInspection.i18n.folding; import com.intellij.codeInsight.intention.IntentionAction; @@ -12,14 +12,12 @@ import org.jetbrains.annotations.NotNull; @SuppressWarnings("IntentionDescriptionNotFoundInspection") public final class EditPropertyValueIntentionAction implements IntentionAction { @Override - @NotNull - public String getText() { + public @NotNull String getText() { return JavaI18nBundle.message("intention.text.edit.property.value"); } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return getText(); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueTooltipManager.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueTooltipManager.java index d110cd235c98..bd89beb131d3 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueTooltipManager.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/EditPropertyValueTooltipManager.java @@ -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.codeInspection.i18n.folding; import com.intellij.codeInsight.hint.HintManagerImpl; @@ -103,8 +103,7 @@ public final class EditPropertyValueTooltipManager implements EditorMouseListene showTooltip(editor, component, false); } - @Nullable - private static String createActionText(@NotNull String actionId, @NotNull String href) { + private static @Nullable String createActionText(@NotNull String actionId, @NotNull String href) { AnAction action = ActionManager.getInstance().getAction(actionId); if (action == null) return null; String text = action.getTemplateText(); diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java index 1655fecee438..bb14cd538dc6 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingBuilder.java @@ -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 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.codeInspection.i18n.folding; import com.intellij.codeInsight.folding.JavaCodeFoldingSettings; @@ -142,8 +142,7 @@ public final class PropertyFoldingBuilder extends FoldingBuilderEx { return null; } - @NotNull - private static String formatMethodCallExpression(@NotNull UCallExpression methodCallExpression) { + private static @NotNull String formatMethodCallExpression(@NotNull UCallExpression methodCallExpression) { return format(methodCallExpression).first; } @@ -153,8 +152,7 @@ public final class PropertyFoldingBuilder extends FoldingBuilderEx { * offset in the formatted string. For each placeholder value substituted in the property value, two couples of offsets are returned - * one for the start of the placeholder, and one for the end. */ - @NotNull - public static Pair>> format(@NotNull UCallExpression methodCallExpression) { + public static @NotNull Pair>> format(@NotNull UCallExpression methodCallExpression) { final List args = methodCallExpression.getValueArguments(); PsiElement callSourcePsi = methodCallExpression.getSourcePsi(); if (args.size() > 0 && args.get(0) instanceof UInjectionHost injectionHost && isI18nProperty(injectionHost)) { @@ -217,14 +215,12 @@ public final class PropertyFoldingBuilder extends FoldingBuilderEx { return text; } - @NotNull - private static String getI18nMessage(@NotNull UInjectionHost injectionHost) { + private static @NotNull String getI18nMessage(@NotNull UInjectionHost injectionHost) { final IProperty property = getI18nProperty(injectionHost); return property == null ? injectionHost.evaluateToString() : formatI18nProperty(injectionHost, property); } - @Nullable - public static IProperty getI18nProperty(@NotNull UInjectionHost injectionHost) { + public static @Nullable IProperty getI18nProperty(@NotNull UInjectionHost injectionHost) { PsiElement sourcePsi = injectionHost.getSourcePsi(); if (sourcePsi == null) return null; final Property property = (Property)sourcePsi.getUserData(CACHE); @@ -262,8 +258,7 @@ public final class PropertyFoldingBuilder extends FoldingBuilderEx { return StringUtil.unquoteString(((String)result)).equals(property.getKey()); } - @NotNull - private static String formatI18nProperty(@NotNull UInjectionHost injectionHost, IProperty property) { + private static @NotNull String formatI18nProperty(@NotNull UInjectionHost injectionHost, IProperty property) { Object evaluated = injectionHost.evaluate(); return property == null ? evaluated != null ? evaluated.toString() : "null" : "\"" + property.getValue() + "\""; diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/DuplicatedPropertiesInspectionProvider.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/DuplicatedPropertiesInspectionProvider.java index 9a1349584f90..26210d4a4e76 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/DuplicatedPropertiesInspectionProvider.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/DuplicatedPropertiesInspectionProvider.java @@ -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.codeInspection.i18n.inconsistentResourceBundle; import com.intellij.codeInspection.*; @@ -22,15 +22,13 @@ import java.util.Set; * @author Dmitry Batkovich */ public class DuplicatedPropertiesInspectionProvider implements InconsistentResourceBundleInspectionProvider { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "REPORT_DUPLICATED_PROPERTIES"; } - @NotNull @Override - public String getPresentableName() { + public @NotNull String getPresentableName() { return JavaI18nBundle.message("inconsistent.bundle.report.duplicate.properties.values"); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentPropertiesEndsInspectionProvider.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentPropertiesEndsInspectionProvider.java index a40cdd70dee8..5a9d58822688 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentPropertiesEndsInspectionProvider.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentPropertiesEndsInspectionProvider.java @@ -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.codeInspection.i18n.inconsistentResourceBundle; import com.intellij.codeInspection.InspectionManager; @@ -24,15 +24,13 @@ public final class InconsistentPropertiesEndsInspectionProvider implements Incon private static final Set PROPERTY_VALUE_END_CHECK_SYMBOLS = Set.of('!', '?', '.', ':', ';'); private static final char NULL = '\0'; - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "REPORT_INCONSISTENT_PROPERTIES_ENDS"; } - @NotNull @Override - public String getPresentableName() { + public @NotNull String getPresentableName() { return JavaI18nBundle.message("inconsistent.bundle.report.inconsistent.properties.ends"); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentResourceBundleInspection.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentResourceBundleInspection.java index 8497d94b3365..ad142adc12e4 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentResourceBundleInspection.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/InconsistentResourceBundleInspection.java @@ -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.codeInspection.i18n.inconsistentResourceBundle; import com.intellij.codeInspection.*; @@ -35,8 +35,7 @@ public final class InconsistentResourceBundleInspection extends GlobalSimpleInsp @Override - @NotNull - public String getShortName() { + public @NotNull String getShortName() { return "InconsistentResourceBundle"; } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/MissingTranslationsInspectionProvider.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/MissingTranslationsInspectionProvider.java index ecaa6d78e472..a6755f764655 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/MissingTranslationsInspectionProvider.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/MissingTranslationsInspectionProvider.java @@ -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.codeInspection.i18n.inconsistentResourceBundle; import com.intellij.codeInspection.*; @@ -18,15 +18,13 @@ import java.util.Set; * @author Dmitry Batkovich */ public final class MissingTranslationsInspectionProvider implements InconsistentResourceBundleInspectionProvider { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "REPORT_MISSING_TRANSLATIONS"; } - @NotNull @Override - public String getPresentableName() { + public @NotNull String getPresentableName() { return JavaI18nBundle.message("inconsistent.bundle.report.missing.translations"); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesKeysConsistencyInspectionProvider.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesKeysConsistencyInspectionProvider.java index c78e01830859..d1447fcb0df0 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesKeysConsistencyInspectionProvider.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesKeysConsistencyInspectionProvider.java @@ -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.codeInspection.i18n.inconsistentResourceBundle; import com.intellij.codeInspection.*; @@ -18,15 +18,13 @@ import java.util.Set; * @author Dmitry Batkovich */ public final class PropertiesKeysConsistencyInspectionProvider implements InconsistentResourceBundleInspectionProvider { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "REPORT_INCONSISTENT_PROPERTIES"; } - @NotNull @Override - public String getPresentableName() { + public @NotNull String getPresentableName() { return JavaI18nBundle.message("inconsistent.bundle.report.inconsistent.properties"); } diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesPlaceholdersInspectionProvider.java b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesPlaceholdersInspectionProvider.java index 5cd36d534526..e45cbb4ff38c 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesPlaceholdersInspectionProvider.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/i18n/inconsistentResourceBundle/PropertiesPlaceholdersInspectionProvider.java @@ -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.codeInspection.i18n.inconsistentResourceBundle; import com.intellij.codeInspection.InspectionManager; @@ -21,15 +21,13 @@ import java.util.*; * @author Dmitry Batkovich */ public final class PropertiesPlaceholdersInspectionProvider implements InconsistentResourceBundleInspectionProvider { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "REPORT_INCONSISTENT_PROPERTIES_PLACEHOLDERS"; } - @NotNull @Override - public String getPresentableName() { + public @NotNull String getPresentableName() { return JavaI18nBundle.message("inconsistent.bundle.report.inconsistent.properties.placeholders"); } diff --git a/plugins/java-i18n/src/com/intellij/java/i18n/JavaI18nBundle.java b/plugins/java-i18n/src/com/intellij/java/i18n/JavaI18nBundle.java index 788ae5710bb0..874eba96d5cd 100644 --- a/plugins/java-i18n/src/com/intellij/java/i18n/JavaI18nBundle.java +++ b/plugins/java-i18n/src/com/intellij/java/i18n/JavaI18nBundle.java @@ -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.java.i18n; import com.intellij.DynamicBundle; @@ -10,19 +10,17 @@ import org.jetbrains.annotations.PropertyKey; import java.util.function.Supplier; public final class JavaI18nBundle { - @NonNls private static final String BUNDLE = "messages.JavaI18nBundle"; + private static final @NonNls String BUNDLE = "messages.JavaI18nBundle"; private static final DynamicBundle INSTANCE = new DynamicBundle(JavaI18nBundle.class, BUNDLE); private JavaI18nBundle() { } - @NotNull - public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { + public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { return INSTANCE.getMessage(key, params); } - @NotNull - public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { + public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { return INSTANCE.getLazyMessage(key, params); } } diff --git a/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java b/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java index e0412fcad6aa..59f0e5ae6959 100644 --- a/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java +++ b/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java @@ -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.lang.properties; import com.intellij.java.i18n.JavaI18nBundle; @@ -36,16 +22,15 @@ import java.util.Set; public class PrefixBasedPropertyReference extends PropertyReference { private boolean myPrefixEvaluated; private boolean myDynamicPrefix; - @Nullable private String myKeyPrefix; - @NonNls private static final String PREFIX_ATTR_NAME = "prefix"; + private @Nullable String myKeyPrefix; + private static final @NonNls String PREFIX_ATTR_NAME = "prefix"; - public PrefixBasedPropertyReference(String key, final PsiElement element, @Nullable final String bundleName, final boolean soft) { + public PrefixBasedPropertyReference(String key, final PsiElement element, final @Nullable String bundleName, final boolean soft) { super(key, element, bundleName, soft); } @Override - @NotNull - protected String getKeyText() { + protected @NotNull String getKeyText() { String keyText = super.getKeyText(); final String keyPrefix = getKeyPrefix(); if (keyPrefix != null) keyText = keyPrefix + keyText; @@ -80,8 +65,7 @@ public class PrefixBasedPropertyReference extends PropertyReference { return super.handleElementRename(newElementName); } - @Nullable - private String getKeyPrefix() { + private @Nullable String getKeyPrefix() { if (!myPrefixEvaluated) { for(PsiElement curParent = PsiTreeUtil.getParentOfType(getElement().getParent().getParent(),XmlTag.class); curParent instanceof XmlTag curParentTag; diff --git a/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesClassReferenceContributor.java b/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesClassReferenceContributor.java index 5912801aee65..d591f1b5551b 100644 --- a/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesClassReferenceContributor.java +++ b/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesClassReferenceContributor.java @@ -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.lang.properties; import com.intellij.lang.properties.psi.impl.PropertyValueImpl; @@ -24,7 +10,7 @@ import org.jetbrains.annotations.NotNull; public final class PropertiesClassReferenceContributor extends PsiReferenceContributor { @Override - public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { + public void registerReferenceProviders(final @NotNull PsiReferenceRegistrar registrar) { JavaClassReferenceProvider CLASS_REFERENCE_PROVIDER = new JavaClassReferenceProvider() { @Override public boolean isSoft() { diff --git a/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesFoldingSettings.java b/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesFoldingSettings.java index 8968d16e0cca..7f160a0fe8a4 100644 --- a/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesFoldingSettings.java +++ b/plugins/java-i18n/src/com/intellij/lang/properties/PropertiesFoldingSettings.java @@ -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.lang.properties; import com.intellij.openapi.application.ApplicationManager; @@ -31,7 +31,7 @@ public class PropertiesFoldingSettings implements PersistentStateComponent !tryToFoldReference(reference, property, result)), getOrCreateIndicator()); } - @NotNull - private static ProgressIndicator getOrCreateIndicator() { + private static @NotNull ProgressIndicator getOrCreateIndicator() { ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator(); if (progress == null) { progress = new EmptyProgressIndicator(); diff --git a/plugins/java-i18n/src/com/intellij/lang/properties/psi/DefaultResourceBundleManager.java b/plugins/java-i18n/src/com/intellij/lang/properties/psi/DefaultResourceBundleManager.java index 6aa20895012b..2b0cfc905f22 100644 --- a/plugins/java-i18n/src/com/intellij/lang/properties/psi/DefaultResourceBundleManager.java +++ b/plugins/java-i18n/src/com/intellij/lang/properties/psi/DefaultResourceBundleManager.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2011 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.lang.properties.psi; @@ -33,8 +19,7 @@ public class DefaultResourceBundleManager extends ResourceBundleManager { } @Override - @Nullable - public PsiClass getResourceBundle() { + public @Nullable PsiClass getResourceBundle() { return JavaPsiFacade.getInstance(myProject).findClass("java.util.ResourceBundle", GlobalSearchScope.allScope(myProject)); } diff --git a/plugins/java-i18n/src/com/intellij/lang/properties/psi/ResourceBundleManager.java b/plugins/java-i18n/src/com/intellij/lang/properties/psi/ResourceBundleManager.java index ccc03d5866de..0e6102492046 100644 --- a/plugins/java-i18n/src/com/intellij/lang/properties/psi/ResourceBundleManager.java +++ b/plugins/java-i18n/src/com/intellij/lang/properties/psi/ResourceBundleManager.java @@ -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.lang.properties.psi; import com.intellij.codeInsight.intention.IntentionAction; @@ -28,23 +28,19 @@ public abstract class ResourceBundleManager { /** * By default returns java.util.ResourceBundle class in context JDK */ - @Nullable - public abstract PsiClass getResourceBundle(); + public abstract @Nullable PsiClass getResourceBundle(); public List suggestPropertiesFiles(@NotNull Set contextModules){ return I18nUtil.defaultSuggestPropertiesFiles(myProject, contextModules); } - @Nullable - public I18nizedTextGenerator getI18nizedTextGenerator() { + public @Nullable I18nizedTextGenerator getI18nizedTextGenerator() { return null; } - @Nullable @NonNls - public abstract String getTemplateName(); + public abstract @Nullable @NonNls String getTemplateName(); - @Nullable @NonNls - public abstract String getConcatenationTemplateName(); + public abstract @Nullable @NonNls String getConcatenationTemplateName(); public abstract boolean isActive(@NotNull PsiFile context) throws ResourceBundleNotFoundException; @@ -54,13 +50,11 @@ public abstract class ResourceBundleManager { return value; } - @Nullable - public static ResourceBundleManager getManager(@NotNull PsiFile context) throws ResourceBundleNotFoundException { + public static @Nullable ResourceBundleManager getManager(@NotNull PsiFile context) throws ResourceBundleNotFoundException { return getManager(Collections.singletonList(context), context.getProject()); } - @Nullable - public static ResourceBundleManager getManager(@NotNull Collection contexts, @NotNull Project project) throws ResourceBundleNotFoundException { + public static @Nullable ResourceBundleManager getManager(@NotNull Collection contexts, @NotNull Project project) throws ResourceBundleNotFoundException { ResourceBundleManager result = null; for (ResourceBundleManager manager : RESOURCE_BUNDLE_MANAGER.getExtensions(project)) { if (isActiveForAny(manager, contexts)) { @@ -87,13 +81,11 @@ public abstract class ResourceBundleManager { return false; } - @Nullable - public PropertyCreationHandler getPropertyCreationHandler() { + public @Nullable PropertyCreationHandler getPropertyCreationHandler() { return null; } - @Nullable - public String suggestPropertyKey(@NotNull final String value) { + public @Nullable String suggestPropertyKey(final @NotNull String value) { return null; } diff --git a/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaReferenceContributor.java b/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaReferenceContributor.java index 5b030c4617dc..b8cc113136cb 100644 --- a/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaReferenceContributor.java +++ b/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaReferenceContributor.java @@ -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.psi.impl.source.resolve.reference.impl.providers; import com.intellij.codeInspection.i18n.JavaI18nUtil; @@ -26,7 +12,7 @@ import org.jetbrains.annotations.NotNull; public final class JavaReferenceContributor extends PsiReferenceContributor { @Override - public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { + public void registerReferenceProviders(final @NotNull PsiReferenceRegistrar registrar) { final PsiReferenceProvider filePathReferenceProvider = new FilePathReferenceProvider() { @Override public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull String text, int offset, boolean soft) { diff --git a/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaXmlClassListReferenceContributor.java b/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaXmlClassListReferenceContributor.java index 53b3d322444d..a81c41f5a877 100644 --- a/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaXmlClassListReferenceContributor.java +++ b/plugins/java-i18n/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaXmlClassListReferenceContributor.java @@ -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.psi.impl.source.resolve.reference.impl.providers; import com.intellij.psi.PsiReferenceContributor; @@ -24,7 +10,7 @@ import static com.intellij.patterns.XmlPatterns.xmlTag; public final class JavaXmlClassListReferenceContributor extends PsiReferenceContributor{ @Override - public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) { + public void registerReferenceProviders(final @NotNull PsiReferenceRegistrar registrar) { final JavaClassListReferenceProvider classListProvider = new JavaClassListReferenceProvider(); registrar.registerReferenceProvider(xmlAttributeValue(), classListProvider, PsiReferenceRegistrar.LOWER_PRIORITY); registrar.registerReferenceProvider(xmlTag(), classListProvider, PsiReferenceRegistrar.LOWER_PRIORITY); diff --git a/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java b/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java index 5cb6ad407c48..c1de64faea1f 100644 --- a/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java +++ b/plugins/java-i18n/src/com/intellij/refactoring/inline/InlinePropertyHandler.java @@ -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.refactoring.inline; import com.intellij.java.i18n.JavaI18nBundle; @@ -97,9 +97,8 @@ public final class InlinePropertyHandler extends JavaInlineActionHandler { }); } - @Nullable @Override - public String getActionName(PsiElement element) { + public @Nullable String getActionName(PsiElement element) { return getRefactoringName(); } diff --git a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java index 21e33221c6fe..c5d897fc8192 100644 --- a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java +++ b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java @@ -157,8 +157,7 @@ public final class JavaFxAntGenerator { } } - @NotNull - private static List getManifestAttributes(@NotNull AbstractJavaFxPackager packager) { + private static @NotNull List getManifestAttributes(@NotNull AbstractJavaFxPackager packager) { final List manifestAttributes = new ArrayList<>(); final String title = packager.getTitle(); if (title != null) { diff --git a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxApplicationIcons.java b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxApplicationIcons.java index 5d9bf5de4512..4aa1428f8926 100644 --- a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxApplicationIcons.java +++ b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxApplicationIcons.java @@ -72,8 +72,7 @@ public class JavaFxApplicationIcons { return result; } - @Nullable - private static String getRelativeIcon(String relativeToPath, String icon) { + private static @Nullable String getRelativeIcon(String relativeToPath, String icon) { if (!StringUtil.isEmpty(icon) && !StringUtil.isEmpty(relativeToPath)) { return FileUtil.getRelativePath(relativeToPath, icon, '/'); } diff --git a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxManifestAttribute.java b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxManifestAttribute.java index b7a6ab56e9ec..64543bd1ba59 100644 --- a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxManifestAttribute.java +++ b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxManifestAttribute.java @@ -15,8 +15,7 @@ public class JavaFxManifestAttribute { myValue = value; } - @NlsSafe - public String getName() { + public @NlsSafe String getName() { return myName; } @@ -24,8 +23,7 @@ public class JavaFxManifestAttribute { myName = name; } - @NlsSafe - public String getValue() { + public @NlsSafe String getValue() { return myValue; } diff --git a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxPackagerConstants.java b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxPackagerConstants.java index a5f0d6e751ab..61c542ce33e8 100644 --- a/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxPackagerConstants.java +++ b/plugins/javaFX/common/src/org/jetbrains/plugins/javaFX/packaging/JavaFxPackagerConstants.java @@ -5,10 +5,10 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; public final class JavaFxPackagerConstants { - @NonNls public static final String UPDATE_MODE_BACKGROUND = "background"; - @NonNls public static final String UPDATE_MODE_ALWAYS = "always"; - @NonNls public static final String DEFAULT_HEIGHT = "400"; - @NonNls public static final String DEFAULT_WEIGHT = "600"; + public static final @NonNls String UPDATE_MODE_BACKGROUND = "background"; + public static final @NonNls String UPDATE_MODE_ALWAYS = "always"; + public static final @NonNls String DEFAULT_HEIGHT = "400"; + public static final @NonNls String DEFAULT_WEIGHT = "600"; public enum NativeBundles { none, all, deb, dmg, exe, image, msi, rpm; @@ -37,8 +37,7 @@ public final class JavaFxPackagerConstants { myIsVerbose = isVerbose; } - @NotNull - public String getCmdLineParam() { + public @NotNull String getCmdLineParam() { return myCmdLineParam; } diff --git a/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactBuildTaskProvider.java b/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactBuildTaskProvider.java index a531555ed3f3..3007afafcc15 100644 --- a/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactBuildTaskProvider.java +++ b/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactBuildTaskProvider.java @@ -31,10 +31,9 @@ import java.util.Set; public class JpsJavaFxArtifactBuildTaskProvider extends ArtifactBuildTaskProvider { - @NotNull @Override - public List createArtifactBuildTasks(@NotNull JpsArtifact artifact, - @NotNull ArtifactBuildPhase buildPhase) { + public @NotNull List createArtifactBuildTasks(@NotNull JpsArtifact artifact, + @NotNull ArtifactBuildPhase buildPhase) { if (buildPhase != ArtifactBuildPhase.POST_PROCESSING) { return Collections.emptyList(); } diff --git a/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactProperties.java b/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactProperties.java index dcae53a0a4e7..939a149ee504 100644 --- a/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactProperties.java +++ b/plugins/javaFX/jps/src/org/jetbrains/plugins/javaFX/JpsJavaFxArtifactProperties.java @@ -46,9 +46,8 @@ public class JpsJavaFxArtifactProperties extends JpsElementBase prepareCustomComponents(Collection psiClasses) { + private @NotNull List prepareCustomComponents(Collection psiClasses) { final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(myProject); final GlobalSearchScope scope = GlobalSearchScope.allScope(myProject); final Map builtinComponents = @@ -204,8 +203,7 @@ public class SceneBuilderImpl implements SceneBuilder { return customComponents; } - @Nullable - private String getComponentModuleName(@NotNull PsiClass psiClass) { + private @Nullable String getComponentModuleName(@NotNull PsiClass psiClass) { final VirtualFile vFile = PsiUtilCore.getVirtualFile(psiClass); if (vFile == null) return null; final Module module = ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(vFile); @@ -359,8 +357,7 @@ public class SceneBuilderImpl implements SceneBuilder { return true; } - @NotNull - private static URLClassLoader createProjectContentClassLoader(Project project, @NotNull ClassLoader parentClassLoader) { + private static @NotNull URLClassLoader createProjectContentClassLoader(Project project, @NotNull ClassLoader parentClassLoader) { final List pathList = ReadAction.compute(() -> OrderEnumerator.orderEntries(project).productionOnly().withoutSdk().recursively() .getPathsList().getPathList()); @@ -405,8 +402,7 @@ public class SceneBuilderImpl implements SceneBuilder { return Collections.emptyList(); } - @NotNull - private static Map loadBuiltinComponents(Predicate psiClassExists) { + private static @NotNull Map loadBuiltinComponents(Predicate psiClassExists) { final Map components = new HashMap<>(); for (LibraryItem item : JavaFXPlatformHelper.getBuiltinLibraryItems()) { final Ref refQualifiedName = new Ref<>(); diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/codeInsight/JavaFxFieldToPropertyIntention.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/codeInsight/JavaFxFieldToPropertyIntention.java index 38ed99f6187b..d314b40cbf8f 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/codeInsight/JavaFxFieldToPropertyIntention.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/codeInsight/JavaFxFieldToPropertyIntention.java @@ -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 org.jetbrains.plugins.javaFX.codeInsight; import com.intellij.codeInsight.intention.LowPriorityAction; @@ -85,8 +85,7 @@ public final class JavaFxFieldToPropertyIntention extends PsiElementBaseIntentio private static final class SearchUsagesTask extends Task.Modal { private final PropertyInfo myProperty; private Collection myReferences; - @Unmodifiable - private Set myFiles; + private @Unmodifiable Set myFiles; SearchUsagesTask(@NotNull Project project, @NotNull PropertyInfo property) { diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathFileType.java b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathFileType.java index bb7a380cb7f2..edcb4a167ec4 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathFileType.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathFileType.java @@ -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.jsonpath; import com.intellij.icons.AllIcons; @@ -15,21 +15,18 @@ public final class JsonPathFileType extends LanguageFileType { super(JsonPathLanguage.INSTANCE); } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "JSONPath"; } - @NotNull @Override - public String getDescription() { + public @NotNull String getDescription() { return JsonPathBundle.message("filetype.jsonpath.description"); } - @NotNull @Override - public String getDefaultExtension() { + public @NotNull String getDefaultExtension() { return "jsonpath"; } diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathLanguage.java b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathLanguage.java index a7dfa07488c9..83ca94a851be 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathLanguage.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathLanguage.java @@ -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.jsonpath; import com.intellij.lang.InjectableLanguage; @@ -7,7 +7,7 @@ import com.intellij.openapi.fileTypes.LanguageFileType; public final class JsonPathLanguage extends Language implements InjectableLanguage { - public final static JsonPathLanguage INSTANCE = new JsonPathLanguage(); + public static final JsonPathLanguage INSTANCE = new JsonPathLanguage(); private JsonPathLanguage() { super("JSONPath"); diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSpellcheckerStrategy.java b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSpellcheckerStrategy.java index a9394ce26fbf..10b36356f2bf 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSpellcheckerStrategy.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSpellcheckerStrategy.java @@ -47,9 +47,8 @@ public final class JsonPathSpellcheckerStrategy extends SpellcheckingStrategy im } }; - @NotNull @Override - public Tokenizer getTokenizer(PsiElement element) { + public @NotNull Tokenizer getTokenizer(PsiElement element) { if (element instanceof JsonPathStringLiteral) { return ourStringLiteralTokenizer; } diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSyntaxHighlighterFactory.java b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSyntaxHighlighterFactory.java index ef00abf772a2..5f4d45a4ee24 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSyntaxHighlighterFactory.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/JsonPathSyntaxHighlighterFactory.java @@ -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.jsonpath; import com.intellij.openapi.fileTypes.SyntaxHighlighter; @@ -8,9 +8,8 @@ import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; final class JsonPathSyntaxHighlighterFactory extends SyntaxHighlighterFactory { - @NotNull @Override - public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { + public @NotNull SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { return new JsonPathSyntaxHighlighter(); } } diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/inspections/JsonPathEvaluateUnknownKeyInspection.java b/plugins/jsonpath/src/com/intellij/jsonpath/inspections/JsonPathEvaluateUnknownKeyInspection.java index 2a8e34bafec9..28fbb4dbb2a8 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/inspections/JsonPathEvaluateUnknownKeyInspection.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/inspections/JsonPathEvaluateUnknownKeyInspection.java @@ -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.jsonpath.inspections; import com.intellij.codeInspection.LocalInspectionTool; @@ -21,9 +21,8 @@ import java.util.Set; import java.util.function.Supplier; final class JsonPathEvaluateUnknownKeyInspection extends LocalInspectionTool { - @NotNull @Override - public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { + public @NotNull PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { Supplier jsonFileSupplier = holder.getFile().getUserData(JsonPathEvaluateManager.JSON_PATH_EVALUATE_SOURCE_KEY); JsonFile sourceFile = jsonFileSupplier != null ? jsonFileSupplier.get() : null; if (sourceFile == null) return PsiElementVisitor.EMPTY_VISITOR; diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathPsiUtils.java b/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathPsiUtils.java index 059d8d23d6af..a7553e84771e 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathPsiUtils.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathPsiUtils.java @@ -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.jsonpath.psi; import com.intellij.openapi.util.Key; @@ -19,8 +19,7 @@ public final class JsonPathPsiUtils { private JsonPathPsiUtils() { } - @NotNull - public static List> getTextFragments(@NotNull JsonPathStringLiteral literal) { + public static @NotNull List> getTextFragments(@NotNull JsonPathStringLiteral literal) { List> cached = literal.getUserData(STRING_FRAGMENTS); if (cached != null) return cached; diff --git a/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathRecursiveElementVisitor.java b/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathRecursiveElementVisitor.java index ee14b3a744ce..179cf95ef648 100644 --- a/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathRecursiveElementVisitor.java +++ b/plugins/jsonpath/src/com/intellij/jsonpath/psi/JsonPathRecursiveElementVisitor.java @@ -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.jsonpath.psi; import com.intellij.psi.PsiElement; @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; public class JsonPathRecursiveElementVisitor extends JsonPathVisitor implements PsiRecursiveVisitor { @Override - public void visitElement(@NotNull final PsiElement element) { + public void visitElement(final @NotNull PsiElement element) { element.acceptChildren(this); } } diff --git a/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java b/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java index ef6815a4e545..c4deeb6bce05 100644 --- a/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java +++ b/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java @@ -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.execution; @@ -25,9 +25,9 @@ import java.util.Set; public final class ConfigurationUtil { // return true if there is JUnit4 test - public static boolean findAllTestClasses(@NotNull final TestClassFilter testClassFilter, - @Nullable final Module module, - @NotNull final Set found) { + public static boolean findAllTestClasses(final @NotNull TestClassFilter testClassFilter, + final @Nullable Module module, + final @NotNull Set found) { final PsiManager manager = testClassFilter.getPsiManager(); final Project project = manager.getProject(); @@ -70,7 +70,7 @@ public final class ConfigurationUtil { private static boolean addAnnotatedMethodsAnSubclasses(final GlobalSearchScope scope, final TestClassFilter testClassFilter, - @Nullable final Module module, + final @Nullable Module module, final Set found, final Set processed, final String annotation, diff --git a/plugins/junit/src/com/intellij/execution/junit/DisabledConditionUtil.java b/plugins/junit/src/com/intellij/execution/junit/DisabledConditionUtil.java index d461bf80cb83..99b630228c7a 100644 --- a/plugins/junit/src/com/intellij/execution/junit/DisabledConditionUtil.java +++ b/plugins/junit/src/com/intellij/execution/junit/DisabledConditionUtil.java @@ -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.execution.junit; import com.intellij.codeInsight.MetaAnnotationUtil; @@ -39,8 +39,7 @@ public final class DisabledConditionUtil { "org.junit.jupiter.api.condition.EnabledOnOs" }; - @Nullable - public static String getDisabledConditionValue(JUnitConfiguration configuration) { + public static @Nullable String getDisabledConditionValue(JUnitConfiguration configuration) { JUnitConfiguration.Data data = configuration.getPersistentData(); if (data == null) return null; diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java b/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java index 55eeeeec52cc..0a0a34e6cc1e 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java @@ -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 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.execution.junit; import com.intellij.ide.fileTemplates.FileTemplateDescriptor; @@ -17,8 +17,7 @@ public class JUnit3Framework extends JUnitTestFramework { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return "JUnit3"; } @@ -45,15 +44,13 @@ public class JUnit3Framework extends JUnitTestFramework { return "junit.framework.TestCase"; } - @Nullable @Override - public ExternalLibraryDescriptor getFrameworkLibraryDescriptor() { + public @Nullable ExternalLibraryDescriptor getFrameworkLibraryDescriptor() { return JUnitExternalLibraryDescriptor.JUNIT3; } @Override - @Nullable - public String getDefaultSuperClass() { + public @Nullable String getDefaultSuperClass() { return "junit.framework.TestCase"; } @@ -69,8 +66,7 @@ public class JUnit3Framework extends JUnitTestFramework { } @Override - @Nullable - protected PsiMethod findSetUpMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findSetUpMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { if (!JUnitUtil.isJUnit3TestClass(clazz)) return null; @@ -82,8 +78,7 @@ public class JUnit3Framework extends JUnitTestFramework { } @Override - @Nullable - protected PsiMethod findTearDownMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findTearDownMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { if (!JUnitUtil.isJUnit3TestClass(clazz)) return null; for (PsiMethod each : clazz.getMethods()) { @@ -94,8 +89,7 @@ public class JUnit3Framework extends JUnitTestFramework { } @Override - @Nullable - protected PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException { + protected @Nullable PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException { final PsiManager manager = clazz.getManager(); final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory(); @@ -135,8 +129,7 @@ public class JUnit3Framework extends JUnitTestFramework { } @Override - @NotNull - public FileTemplateDescriptor getTestMethodFileTemplateDescriptor() { + public @NotNull FileTemplateDescriptor getTestMethodFileTemplateDescriptor() { return new FileTemplateDescriptor("JUnit3 Test Method.java"); } } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnit4Framework.java b/plugins/junit/src/com/intellij/execution/junit/JUnit4Framework.java index fc6cfd9df234..74198336eb90 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnit4Framework.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnit4Framework.java @@ -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 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.execution.junit; import com.intellij.codeInsight.AnnotationUtil; @@ -22,8 +22,7 @@ public class JUnit4Framework extends JUnitTestFramework { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return "JUnit4"; } @@ -32,15 +31,13 @@ public class JUnit4Framework extends JUnitTestFramework { return JUnitUtil.TEST_ANNOTATION; } - @Nullable @Override - public ExternalLibraryDescriptor getFrameworkLibraryDescriptor() { + public @Nullable ExternalLibraryDescriptor getFrameworkLibraryDescriptor() { return JUnitExternalLibraryDescriptor.JUNIT4; } @Override - @Nullable - public String getDefaultSuperClass() { + public @Nullable String getDefaultSuperClass() { return null; } @@ -54,9 +51,8 @@ public class JUnit4Framework extends JUnitTestFramework { }, false); } - @Nullable @Override - protected PsiMethod findSetUpMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findSetUpMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (AnnotationUtil.isAnnotated(each, JUnitUtil.BEFORE_ANNOTATION_NAME, 0)) return each; @@ -65,9 +61,8 @@ public class JUnit4Framework extends JUnitTestFramework { }, null); } - @Nullable @Override - protected PsiMethod findBeforeClassMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findBeforeClassMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (each.hasModifierProperty(PsiModifier.STATIC) @@ -79,9 +74,8 @@ public class JUnit4Framework extends JUnitTestFramework { }, null); } - @Nullable @Override - protected PsiMethod findTearDownMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findTearDownMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (AnnotationUtil.isAnnotated(each, JUnitUtil.AFTER_ANNOTATION_NAME, 0)) return each; @@ -90,9 +84,8 @@ public class JUnit4Framework extends JUnitTestFramework { }, null); } - @Nullable @Override - protected PsiMethod findAfterClassMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findAfterClassMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (each.hasModifierProperty(PsiModifier.STATIC) @@ -105,8 +98,7 @@ public class JUnit4Framework extends JUnitTestFramework { } @Override - @Nullable - protected PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException { + protected @Nullable PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException { String beforeClassAnnotationName = JUnitUtil.BEFORE_CLASS_ANNOTATION_NAME; String beforeAnnotationName = JUnitUtil.BEFORE_ANNOTATION_NAME; return findOrCreateSetUpMethod(clazz, beforeClassAnnotationName, beforeAnnotationName); @@ -180,8 +172,7 @@ public class JUnit4Framework extends JUnitTestFramework { } @Override - @NotNull - public FileTemplateDescriptor getTestMethodFileTemplateDescriptor() { + public @NotNull FileTemplateDescriptor getTestMethodFileTemplateDescriptor() { return new FileTemplateDescriptor("JUnit4 Test Method.java"); } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnit5Framework.java b/plugins/junit/src/com/intellij/execution/junit/JUnit5Framework.java index 2b6f425025b8..4899eaf4b821 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnit5Framework.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnit5Framework.java @@ -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.execution.junit; import com.intellij.codeInsight.AnnotationUtil; @@ -24,8 +24,7 @@ public class JUnit5Framework extends JUnitTestFramework { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return "JUnit5"; } @@ -48,15 +47,13 @@ public class JUnit5Framework extends JUnitTestFramework { return true; } - @Nullable @Override - public ExternalLibraryDescriptor getFrameworkLibraryDescriptor() { + public @Nullable ExternalLibraryDescriptor getFrameworkLibraryDescriptor() { return JUnitExternalLibraryDescriptor.JUNIT5; } @Override - @Nullable - public String getDefaultSuperClass() { + public @Nullable String getDefaultSuperClass() { return null; } @@ -69,9 +66,8 @@ public class JUnit5Framework extends JUnitTestFramework { }, false); } - @Nullable @Override - protected PsiMethod findSetUpMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findSetUpMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), ()->{ for (PsiMethod each : clazz.getMethods()) { if (AnnotationUtil.isAnnotated(each, JUnitUtil.BEFORE_EACH_ANNOTATION_NAME, 0)) return each; @@ -80,9 +76,8 @@ public class JUnit5Framework extends JUnitTestFramework { }, null); } - @Nullable @Override - protected PsiMethod findBeforeClassMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findBeforeClassMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (each.hasModifierProperty(PsiModifier.STATIC) @@ -92,9 +87,8 @@ public class JUnit5Framework extends JUnitTestFramework { }, null); } - @Nullable @Override - protected PsiMethod findTearDownMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findTearDownMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (AnnotationUtil.isAnnotated(each, JUnitUtil.AFTER_EACH_ANNOTATION_NAME, 0)) return each; @@ -103,9 +97,8 @@ public class JUnit5Framework extends JUnitTestFramework { }, null); } - @Nullable @Override - protected PsiMethod findAfterClassMethod(@NotNull PsiClass clazz) { + protected @Nullable PsiMethod findAfterClassMethod(@NotNull PsiClass clazz) { return callWithAlternateResolver(clazz.getProject(), () -> { for (PsiMethod each : clazz.getMethods()) { if (each.hasModifierProperty(PsiModifier.STATIC) @@ -118,8 +111,7 @@ public class JUnit5Framework extends JUnitTestFramework { } @Override - @Nullable - protected PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException { + protected @Nullable PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException { PsiMethod method = findSetUpMethod(clazz); if (method != null) return method; @@ -190,8 +182,7 @@ public class JUnit5Framework extends JUnitTestFramework { } @Override - @NotNull - public FileTemplateDescriptor getTestMethodFileTemplateDescriptor() { + public @NotNull FileTemplateDescriptor getTestMethodFileTemplateDescriptor() { return new FileTemplateDescriptor("JUnit5 Test Method.java"); } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitAddToTestsPatternAction.java b/plugins/junit/src/com/intellij/execution/junit/JUnitAddToTestsPatternAction.java index c43e99fcb3cd..80005bac3ee0 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitAddToTestsPatternAction.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitAddToTestsPatternAction.java @@ -1,24 +1,10 @@ -/* - * 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.execution.junit; import com.intellij.execution.actions.AbstractAddToTestsPatternAction; -import com.intellij.execution.configurations.ConfigurationType; import com.intellij.execution.actions.RunConfigurationProducer; +import com.intellij.execution.configurations.ConfigurationType; import org.jetbrains.annotations.NotNull; import java.util.Set; @@ -26,14 +12,12 @@ import java.util.Set; public class JUnitAddToTestsPatternAction extends AbstractAddToTestsPatternAction { @Override - @NotNull - protected PatternConfigurationProducer getPatternBasedProducer() { + protected @NotNull PatternConfigurationProducer getPatternBasedProducer() { return RunConfigurationProducer.getInstance(PatternConfigurationProducer.class); } @Override - @NotNull - protected ConfigurationType getConfigurationType() { + protected @NotNull ConfigurationType getConfigurationType() { return JUnitConfigurationType.getInstance(); } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java b/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java index 7054bab56661..023933a58617 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java @@ -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.execution.junit; @@ -63,27 +63,27 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor public static final byte FRAMEWORK_ID = 0x0; - @NonNls public static final String TEST_CLASS = "class"; - @NonNls public static final String TEST_PACKAGE = "package"; - @NonNls public static final String TEST_DIRECTORY = "directory"; - @NonNls public static final String TEST_CATEGORY = "category"; - @NonNls public static final String TEST_METHOD = "method"; - @NonNls public static final String TEST_UNIQUE_ID = "uniqueId"; - @NonNls public static final String TEST_TAGS = "tags"; - @NonNls public static final String BY_SOURCE_POSITION = "source location"; - @NonNls public static final String BY_SOURCE_CHANGES = "changes"; + public static final @NonNls String TEST_CLASS = "class"; + public static final @NonNls String TEST_PACKAGE = "package"; + public static final @NonNls String TEST_DIRECTORY = "directory"; + public static final @NonNls String TEST_CATEGORY = "category"; + public static final @NonNls String TEST_METHOD = "method"; + public static final @NonNls String TEST_UNIQUE_ID = "uniqueId"; + public static final @NonNls String TEST_TAGS = "tags"; + public static final @NonNls String BY_SOURCE_POSITION = "source location"; + public static final @NonNls String BY_SOURCE_CHANGES = "changes"; //fork modes - @NonNls public static final String FORK_NONE = "none"; - @NonNls public static final String FORK_METHOD = "method"; - @NonNls public static final String FORK_KLASS = "class"; - @NonNls public static final String FORK_REPEAT = "repeat"; + public static final @NonNls String FORK_NONE = "none"; + public static final @NonNls String FORK_METHOD = "method"; + public static final @NonNls String FORK_KLASS = "class"; + public static final @NonNls String FORK_REPEAT = "repeat"; // See #26522 - @NonNls public static final String JUNIT_START_CLASS = "com.intellij.rt.junit.JUnitStarter"; - @NonNls private static final String PATTERN_EL_NAME = "pattern"; - @NonNls public static final String TEST_PATTERN = PATTERN_EL_NAME; - @NonNls private static final String TEST_CLASS_ATT_NAME = "testClass"; - @NonNls private static final String PATTERNS_EL_NAME = "patterns"; + public static final @NonNls String JUNIT_START_CLASS = "com.intellij.rt.junit.JUnitStarter"; + private static final @NonNls String PATTERN_EL_NAME = "pattern"; + public static final @NonNls String TEST_PATTERN = PATTERN_EL_NAME; + private static final @NonNls String TEST_CLASS_ATT_NAME = "testClass"; + private static final @NonNls String PATTERNS_EL_NAME = "patterns"; private final Data myData; private final InputRedirectAware.InputRedirectOptionsImpl myInputRedirectOptions = new InputRedirectOptionsImpl(); @@ -109,7 +109,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor }; final RefactoringListeners.Accessor myClass = new RefactoringListeners.Accessor<>() { @Override - public void setName(@NotNull final String qualifiedName) { + public void setName(final @NotNull String qualifiedName) { final boolean generatedName = isGeneratedName(); myData.MAIN_CLASS_NAME = qualifiedName; if (generatedName) setGeneratedName(); @@ -130,7 +130,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor final RefactoringListeners.Accessor myCategory = new RefactoringListeners.Accessor<>() { @Override - public void setName(@NotNull final String qualifiedName) { + public void setName(final @NotNull String qualifiedName) { setCategory(qualifiedName); } @@ -166,7 +166,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor } @Override - public TestObject getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException { + public TestObject getState(final @NotNull Executor executor, final @NotNull ExecutionEnvironment env) throws ExecutionException { TestObject testObject = TestObject.fromString(myData.TEST_OBJECT, this, env); DumbService dumbService = DumbService.getInstance(getProject()); if (testObject != null && !dumbService.isUsableInCurrentContext(testObject)) { @@ -176,8 +176,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor } @Override - @NotNull - public SettingsEditor getConfigurationEditor() { + public @NotNull SettingsEditor getConfigurationEditor() { if (Registry.is("ide.new.run.config.junit", true)) { return new JUnitSettingsEditor(this); } @@ -270,8 +269,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor } @Override - @NotNull - public Map getEnvs() { + public @NotNull Map getEnvs() { return myData.getEnvs(); } @@ -434,14 +432,13 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor return myData.getTestObject(this); } - @NotNull @Override - public InputRedirectOptions getInputRedirectOptions() { + public @NotNull InputRedirectOptions getInputRedirectOptions() { return myInputRedirectOptions; } @Override - public void readExternal(@NotNull final Element element) throws InvalidDataException { + public void readExternal(final @NotNull Element element) throws InvalidDataException { super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); DefaultJDOMExternalizer.readExternal(this, element); @@ -513,7 +510,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor } @Override - public void writeExternal(@NotNull final Element element) { + public void writeExternal(final @NotNull Element element) { super.writeExternal(element); JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element); DefaultJDOMExternalizer.write(this, element, JavaParametersUtil.getFilter(this)); @@ -637,9 +634,8 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor myData.REPEAT_MODE = repeatMode; } - @NotNull @Override - public SMTRunnerConsoleProperties createTestConsoleProperties(@NotNull Executor executor) { + public @NotNull SMTRunnerConsoleProperties createTestConsoleProperties(@NotNull Executor executor) { JUnitConsoleProperties properties = new JUnitConsoleProperties(this, executor); properties.setIdBasedTestTree(getTestObject().isIdBasedTestTree()); return properties; @@ -655,15 +651,13 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor return target.getRuntimes().findByType(JavaLanguageRuntimeConfiguration.class) != null; } - @Nullable @Override - public LanguageRuntimeType getDefaultLanguageRuntimeType() { + public @Nullable LanguageRuntimeType getDefaultLanguageRuntimeType() { return LanguageRuntimeType.EXTENSION_NAME.findExtension(JavaLanguageRuntimeType.class); } - @Nullable @Override - public String getDefaultTargetName() { + public @Nullable String getDefaultTargetName() { return getOptions().getRemoteTarget(); } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationProducer.java b/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationProducer.java index 78b0c3a87882..d4fa06c46330 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationProducer.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationProducer.java @@ -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.execution.junit; import com.intellij.execution.configurations.ConfigurationFactory; @@ -10,9 +10,8 @@ public abstract class JUnitConfigurationProducer extends AbstractJavaTestConfigu super(); } - @NotNull @Override - public ConfigurationFactory getConfigurationFactory() { + public @NotNull ConfigurationFactory getConfigurationFactory() { return JUnitConfigurationType.getInstance().getConfigurationFactories()[0]; } } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationType.java b/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationType.java index 607e88501d9b..ca6b06873844 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationType.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationType.java @@ -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.execution.junit; @@ -24,8 +24,7 @@ public final class JUnitConfigurationType implements ConfigurationType { public JUnitConfigurationType() { myFactory = new ConfigurationFactory(this) { @Override - @NotNull - public RunConfiguration createTemplateConfiguration(@NotNull Project project) { + public @NotNull RunConfiguration createTemplateConfiguration(@NotNull Project project) { return new JUnitConfiguration("", project, this); } @@ -41,9 +40,8 @@ public final class JUnitConfigurationType implements ConfigurationType { }; } - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return JUnitBundle.message("junit.configuration.display.name"); } @@ -68,14 +66,12 @@ public final class JUnitConfigurationType implements ConfigurationType { } @Override - @NotNull - public String getId() { + public @NotNull String getId() { return "JUnit"; } - @NotNull @Override - public String getTag() { + public @NotNull String getTag() { String id = getId(); return id.equals("JUnit") ? "junit" : id; } @@ -89,8 +85,7 @@ public final class JUnitConfigurationType implements ConfigurationType { return myFactory; } - @NotNull - public static JUnitConfigurationType getInstance() { + public static @NotNull JUnitConfigurationType getInstance() { return ConfigurationTypeUtil.findConfigurationType(JUnitConfigurationType.class); } } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java b/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java index 1fdd47ad7fbc..ce1db0fe78ad 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitDebuggerRunner.java @@ -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.execution.junit; import com.intellij.execution.JavaTestFrameworkDebuggerRunner; @@ -11,15 +11,13 @@ public class JUnitDebuggerRunner extends JavaTestFrameworkDebuggerRunner { return profile instanceof JUnitConfiguration; } - @NotNull @Override - protected String getThreadName() { + protected @NotNull String getThreadName() { return "junit"; } - @NotNull @Override - public String getRunnerId() { + public @NotNull String getRunnerId() { return "JUnitDebug"; } } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitDependencyScopeSuggester.java b/plugins/junit/src/com/intellij/execution/junit/JUnitDependencyScopeSuggester.java index fa6f754aa7e1..0d5604c7e76a 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitDependencyScopeSuggester.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitDependencyScopeSuggester.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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.execution.junit; import com.intellij.openapi.roots.DependencyScope; @@ -33,9 +19,8 @@ public final class JUnitDependencyScopeSuggester extends LibraryDependencyScopeS "org.junit.jupiter.api.Test", "org.junit.platform.commons.JUnitException", "org.opentest4j.AssertionFailedError" }; - @Nullable @Override - public DependencyScope getDefaultDependencyScope(@NotNull Library library) { + public @Nullable DependencyScope getDefaultDependencyScope(@NotNull Library library) { VirtualFile[] files = library.getFiles(OrderRootType.CLASSES); long testJars = Arrays.stream(files).filter(JUnitDependencyScopeSuggester::isTestJarRoot).count(); long regularJars = files.length - testJars; diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitExternalLibraryDescriptor.java b/plugins/junit/src/com/intellij/execution/junit/JUnitExternalLibraryDescriptor.java index 2630d1b68342..f7481c404cc3 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitExternalLibraryDescriptor.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitExternalLibraryDescriptor.java @@ -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 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.execution.junit; import com.intellij.openapi.roots.ExternalLibraryDescriptor; @@ -23,9 +23,8 @@ public final class JUnitExternalLibraryDescriptor extends ExternalLibraryDescrip myVersion = version; } - @NotNull @Override - public String getPresentableName() { + public @NotNull String getPresentableName() { return "JUnit" + myVersion; } } diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnitRunDashboardCustomizer.java b/plugins/junit/src/com/intellij/execution/junit/JUnitRunDashboardCustomizer.java index cea431d6e80f..6eca21bfc7e3 100644 --- a/plugins/junit/src/com/intellij/execution/junit/JUnitRunDashboardCustomizer.java +++ b/plugins/junit/src/com/intellij/execution/junit/JUnitRunDashboardCustomizer.java @@ -1,4 +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.execution.junit; import com.intellij.execution.RunnerAndConfigurationSettings; @@ -19,8 +19,7 @@ public final class JUnitRunDashboardCustomizer extends RunDashboardCustomizer { } @Override - @Nullable - public PsiElement getPsiElement(@NotNull RunDashboardRunConfigurationNode node) { + public @Nullable PsiElement getPsiElement(@NotNull RunDashboardRunConfigurationNode node) { RunConfiguration runConfiguration = node.getConfigurationSettings().getConfiguration(); if (!(runConfiguration instanceof JUnitConfiguration jUnitConfiguration)) return null; diff --git a/plugins/junit/src/com/intellij/execution/junit/TestClass.java b/plugins/junit/src/com/intellij/execution/junit/TestClass.java index fa19f397049d..28215eb1cd81 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestClass.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestClass.java @@ -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.execution.junit; @@ -38,9 +38,8 @@ class TestClass extends TestObject { options.add(StringUtil.getPackageName(getConfiguration().getPersistentData().getMainClassName())); } - @NotNull @Override - protected String getForkMode() { + protected @NotNull String getForkMode() { String forkMode = super.getForkMode(); return JUnitConfiguration.FORK_KLASS.equals(forkMode) ? JUnitConfiguration.FORK_REPEAT : forkMode; } diff --git a/plugins/junit/src/com/intellij/execution/junit/TestClassFilter.java b/plugins/junit/src/com/intellij/execution/junit/TestClassFilter.java index 2ea56c630546..aaee2ac010cb 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestClassFilter.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestClassFilter.java @@ -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 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.execution.junit; @@ -72,19 +72,16 @@ public class TestClassFilter implements ClassFilter.ClassFilterWithScope { return false; } - @NotNull - public TestClassFilter intersectionWith(final GlobalSearchScope scope) { + public @NotNull TestClassFilter intersectionWith(final GlobalSearchScope scope) { return new TestClassFilter(myBase, myScope.intersectWith(scope)); } - @NotNull - public static TestClassFilter create(final SourceScope sourceScope, final Module module) throws JUnitUtil.NoJUnitException { + public static @NotNull TestClassFilter create(final SourceScope sourceScope, final Module module) throws JUnitUtil.NoJUnitException { final PsiClass testCase = getTestCase(sourceScope, module); return new TestClassFilter(testCase, sourceScope.getGlobalSearchScope()); } - @NotNull - private static PsiClass getTestCase(final SourceScope sourceScope, final Module module) throws JUnitUtil.NoJUnitException { + private static @NotNull PsiClass getTestCase(final SourceScope sourceScope, final Module module) throws JUnitUtil.NoJUnitException { if (sourceScope == null) throw new JUnitUtil.NoJUnitException(); return ReadAction.compute(() -> module == null ? JUnitUtil.getTestCaseClass(sourceScope) : JUnitUtil.getTestCaseClass(module)); } @@ -136,6 +133,5 @@ public class TestClassFilter implements ClassFilter.ClassFilterWithScope { @Override public GlobalSearchScope getScope() { return myScope; } - @Nullable - public PsiClass getBase() { return myBase; } + public @Nullable PsiClass getBase() { return myBase; } } diff --git a/plugins/junit/src/com/intellij/execution/junit/TestDirectory.java b/plugins/junit/src/com/intellij/execution/junit/TestDirectory.java index 80537d936fa4..e7dfb02fe2c3 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestDirectory.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestDirectory.java @@ -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.execution.junit; import com.intellij.execution.*; @@ -37,9 +37,8 @@ class TestDirectory extends TestPackage { super(configuration, environment); } - @Nullable @Override - public SourceScope getSourceScope() { + public @Nullable SourceScope getSourceScope() { final String dirName = getConfiguration().getPersistentData().getDirName(); final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName)); final Project project = getConfiguration().getProject(); @@ -179,9 +178,8 @@ class TestDirectory extends TestPackage { } } - @NotNull @Override - protected PsiPackage getPackage() throws CantRunException { + protected @NotNull PsiPackage getPackage() throws CantRunException { final PsiDirectory directory = getDirectory(getConfiguration().getPersistentData()); PsiPackage aPackage = ReadAction.compute(() -> JavaDirectoryService.getInstance().getPackageInSources(directory)); if (aPackage == null) throw CantRunException.packageNotFound(directory.getName()); diff --git a/plugins/junit/src/com/intellij/execution/junit/TestInClassConfigurationProducer.java b/plugins/junit/src/com/intellij/execution/junit/TestInClassConfigurationProducer.java index 1ceff01ce784..0df6e21e835f 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestInClassConfigurationProducer.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestInClassConfigurationProducer.java @@ -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.execution.junit; import com.intellij.execution.actions.ConfigurationContext; @@ -42,9 +42,8 @@ public final class TestInClassConfigurationProducer extends JUnitConfigurationPr } private static class JUnitInClassConfigurationProducerDelegate extends AbstractInClassConfigurationProducer { - @NotNull @Override - public ConfigurationFactory getConfigurationFactory() { + public @NotNull ConfigurationFactory getConfigurationFactory() { return JUnitConfigurationType.getInstance().getConfigurationFactories()[0]; } diff --git a/plugins/junit/src/com/intellij/execution/junit/TestMethod.java b/plugins/junit/src/com/intellij/execution/junit/TestMethod.java index 9b729d6f94a5..35e78990d5b8 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestMethod.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestMethod.java @@ -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.execution.junit; @@ -66,7 +66,7 @@ public class TestMethod extends TestObject { if (!method.getContainingClass().equals(configuration.myClass.getPsiElement())) return null; class Listener extends RefactoringElementAdapter implements UndoRefactoringElementListener { @Override - public void elementRenamedOrMoved(@NotNull final PsiElement newElement) { + public void elementRenamedOrMoved(final @NotNull PsiElement newElement) { final boolean generatedName = configuration.isGeneratedName(); configuration.getPersistentData().setTestMethod(PsiLocation.fromPsiElement((PsiMethod)UastContextKt.toUElement(newElement))); if (generatedName) configuration.setGeneratedName(); @@ -136,8 +136,7 @@ public class TestMethod extends TestObject { } } - @NotNull - public PsiClass checkClass() throws RuntimeConfigurationException { + public @NotNull PsiClass checkClass() throws RuntimeConfigurationException { final JavaRunConfigurationModule configurationModule = getConfiguration().getConfigurationModule(); final JUnitConfiguration.Data data = getConfiguration().getPersistentData(); final String testClass = data.getMainClassName(); diff --git a/plugins/junit/src/com/intellij/execution/junit/TestMethods.java b/plugins/junit/src/com/intellij/execution/junit/TestMethods.java index 8f802c32bb44..fa22e007259b 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestMethods.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestMethods.java @@ -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.execution.junit; @@ -84,9 +70,8 @@ public class TestMethods extends TestMethod { return super.retrievePsiElement(element); } - @Nullable @Override - public SourceScope getSourceScope() { + public @Nullable SourceScope getSourceScope() { final JUnitConfiguration.Data data = getConfiguration().getPersistentData(); return data.getScope().getSourceScope(getConfiguration()); } @@ -96,8 +81,7 @@ public class TestMethods extends TestMethod { return super.configureByModule(module) && getConfiguration().getPersistentData().getScope() != TestSearchScope.WHOLE_PROJECT; } - @Nullable - public static String getTestPresentation(AbstractTestProxy testInfo, Project project, GlobalSearchScope searchScope) { + public static @Nullable String getTestPresentation(AbstractTestProxy testInfo, Project project, GlobalSearchScope searchScope) { final Location location = testInfo.getLocation(project, searchScope); final PsiElement element = location != null ? location.getPsiElement() : null; if (element instanceof PsiMethod) { diff --git a/plugins/junit/src/com/intellij/execution/junit/TestObject.java b/plugins/junit/src/com/intellij/execution/junit/TestObject.java index 77da3fd1317d..0f325ff2c5e4 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestObject.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestObject.java @@ -218,8 +218,7 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState composeDirectoryFilter(@NotNull Module module) { + protected static @Unmodifiable List composeDirectoryFilter(@NotNull Module module) { return ContainerUtil.map(OrderEnumerator.orderEntries(module) .withoutSdk() .withoutLibraries() @@ -530,9 +528,8 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState { try { @@ -187,8 +185,7 @@ public class TestPackage extends TestObject { return false; } - @NotNull - protected @NlsSafe String getPackageName(JUnitConfiguration.Data data) throws CantRunException { + protected @NotNull @NlsSafe String getPackageName(JUnitConfiguration.Data data) throws CantRunException { return data.getPackageName(); } @@ -250,8 +247,7 @@ public class TestPackage extends TestObject { return ReadAction.compute(() -> PackageScope.packageScope(getPackage(), true)); } - @NotNull - protected PsiPackage getPackage() throws CantRunException { + protected @NotNull PsiPackage getPackage() throws CantRunException { final String packageName = getConfiguration().getPersistentData().getPackageName(); final PsiPackage aPackage = JavaPsiFacade.getInstance(getConfiguration().getProject()).findPackage(packageName); if (aPackage == null) throw CantRunException.packageNotFound(packageName); diff --git a/plugins/junit/src/com/intellij/execution/junit/TestTags.java b/plugins/junit/src/com/intellij/execution/junit/TestTags.java index 5b478ff85120..535b44e1b20f 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestTags.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestTags.java @@ -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.execution.junit; import com.intellij.execution.ExecutionException; @@ -44,9 +44,8 @@ class TestTags extends TestObject { parseAsJavaExpression(tags); } - @Nullable @Override - public SourceScope getSourceScope() { + public @Nullable SourceScope getSourceScope() { final JUnitConfiguration.Data data = getConfiguration().getPersistentData(); return data.getScope().getSourceScope(getConfiguration()); } diff --git a/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java b/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java index 62dd156d3ba7..bc9406a34c33 100644 --- a/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java +++ b/plugins/junit/src/com/intellij/execution/junit/TestsPattern.java @@ -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.execution.junit; import com.intellij.execution.*; @@ -36,9 +36,8 @@ public class TestsPattern extends TestPackage { return TestClassFilter.create(getSourceScope(), getConfiguration().getConfigurationModule().getModule(), data.getPatternPresentation()); } - @NotNull @Override - protected String getPackageName(JUnitConfiguration.Data data) { + protected @NotNull String getPackageName(JUnitConfiguration.Data data) { return ""; } @@ -128,9 +127,8 @@ public class TestsPattern extends TestPackage { return null; } - @Nullable @Override - public RefactoringElementListener getListener(PsiElement element) { + public @Nullable RefactoringElementListener getListener(PsiElement element) { final RefactoringElementListenerComposite composite = new RefactoringElementListenerComposite(); final JUnitConfiguration.Data data = getConfiguration().getPersistentData(); final Set patterns = data.getPatterns(); diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnit5ExternalLibraryResolver.java b/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnit5ExternalLibraryResolver.java index 691e7dcb9b74..ef4df15997a7 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnit5ExternalLibraryResolver.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnit5ExternalLibraryResolver.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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.execution.junit.codeInsight; import com.intellij.codeInsight.daemon.quickFix.ExternalLibraryResolver; @@ -29,18 +15,16 @@ public final class JUnit5ExternalLibraryResolver extends ExternalLibraryResolver private static final Set JUNIT5_ANNOTATIONS = Set.of( "Test", "Disabled", "TestFactory", "BeforeEach", "BeforeAll", "AfterEach", "AfterAll", "DisplayName", "Nested" ); - @Nullable @Override - public ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) { + public @Nullable ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) { if (isAnnotation == ThreeState.YES && JUNIT5_ANNOTATIONS.contains(shortClassName)) { return new ExternalClassResolveResult("org.junit.jupiter.api." + shortClassName, JUnitExternalLibraryDescriptor.JUNIT5); } return null; } - @Nullable @Override - public ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) { + public @Nullable ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) { if (packageName.equals("org.junit.jupiter") || packageName.equals("org.junit")) { return JUnitExternalLibraryDescriptor.JUNIT5; } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnitExternalLibraryResolver.java b/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnitExternalLibraryResolver.java index e3b1948666eb..5b24abebd62b 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnitExternalLibraryResolver.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInsight/JUnitExternalLibraryResolver.java @@ -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.execution.junit.codeInsight; import com.intellij.codeInsight.daemon.quickFix.ExternalLibraryResolver; @@ -29,9 +15,8 @@ public final class JUnitExternalLibraryResolver extends ExternalLibraryResolver private static final Set JUNIT4_ANNOTATIONS = Set.of( "Test", "Ignore", "RunWith", "Before", "BeforeClass", "After", "AfterClass" ); - @Nullable @Override - public ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) { + public @Nullable ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) { if ("TestCase".equals(shortClassName)) { return new ExternalClassResolveResult("junit.framework.TestCase", JUnitExternalLibraryDescriptor.JUNIT3); } @@ -41,9 +26,8 @@ public final class JUnitExternalLibraryResolver extends ExternalLibraryResolver return null; } - @Nullable @Override - public ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) { + public @Nullable ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) { if (packageName.equals("org.junit")) { return JUnitExternalLibraryDescriptor.JUNIT4; } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/ExpectedExceptionNeverThrownInspection.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/ExpectedExceptionNeverThrownInspection.java index 0d0b752a3ebf..77eb142e0534 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/ExpectedExceptionNeverThrownInspection.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/ExpectedExceptionNeverThrownInspection.java @@ -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.execution.junit.codeInspection; import com.intellij.codeInsight.AnnotationUtil; @@ -15,9 +15,8 @@ import java.util.List; public final class ExpectedExceptionNeverThrownInspection extends BaseInspection { - @NotNull @Override - protected String buildErrorString(Object... infos) { + protected @NotNull String buildErrorString(Object... infos) { final PsiMethod method = (PsiMethod)infos[0]; return JUnitBundle.message("expected.exception.never.thrown.problem.descriptor", method.getName()); } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/JUnit3StyleTestMethodInJUnit4ClassInspection.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/JUnit3StyleTestMethodInJUnit4ClassInspection.java index 35c9def98e42..170cde70b919 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/JUnit3StyleTestMethodInJUnit4ClassInspection.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/JUnit3StyleTestMethodInJUnit4ClassInspection.java @@ -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.execution.junit.codeInspection; import com.intellij.codeInsight.AnnotationUtil; @@ -20,15 +20,13 @@ import org.jetbrains.annotations.Nullable; */ public final class JUnit3StyleTestMethodInJUnit4ClassInspection extends BaseInspection { - @NotNull @Override - protected String buildErrorString(Object... infos) { + protected @NotNull String buildErrorString(Object... infos) { return JUnitBundle.message("junit3.style.test.method.in.junit4.class.problem.descriptor"); } - @Nullable @Override - protected LocalQuickFix buildFix(Object... infos) { + protected @Nullable LocalQuickFix buildFix(Object... infos) { return new AddAnnotationPsiFix("org.junit.Test", (PsiMethod)infos[0]); } @@ -50,7 +48,7 @@ public final class JUnit3StyleTestMethodInJUnit4ClassInspection extends BaseInsp final TestFramework testFramework = TestFrameworks.detectFramework(containingClass); if (testFramework != null) { if (testFramework.isTestMethod(method, false)) { - @NonNls final String testFrameworkName = testFramework.getName(); + final @NonNls String testFrameworkName = testFramework.getName(); if (testFrameworkName.equals("JUnit4") || testFrameworkName.equals("JUnit5")) return; } if (AnnotationUtil.isAnnotated(method, "org.junit.Ignore", 0) || @@ -78,7 +76,7 @@ public final class JUnit3StyleTestMethodInJUnit4ClassInspection extends BaseInsp @Override public void visitAnnotation(@NotNull PsiAnnotation annotation) { super.visitAnnotation(annotation); - @NonNls final String qualifiedName = annotation.getQualifiedName(); + final @NonNls String qualifiedName = annotation.getQualifiedName(); if (qualifiedName == null || !qualifiedName.startsWith("org.junit.")) { return; } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/MultipleExceptionsDeclaredOnTestMethodInspection.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/MultipleExceptionsDeclaredOnTestMethodInspection.java index 26b74bffdb82..9f9d478d82a4 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/MultipleExceptionsDeclaredOnTestMethodInspection.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/MultipleExceptionsDeclaredOnTestMethodInspection.java @@ -1,12 +1,12 @@ -// 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.execution.junit.codeInspection; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.CommonQuickFixBundle; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.execution.JUnitBundle; -import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.modcommand.ModPsiUpdater; +import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; @@ -19,9 +19,8 @@ import org.jetbrains.annotations.NotNull; public final class MultipleExceptionsDeclaredOnTestMethodInspection extends BaseInspection implements CleanupLocalInspectionTool { - @NotNull @Override - protected String buildErrorString(Object... infos) { + protected @NotNull String buildErrorString(Object... infos) { return JUnitBundle.message( "multiple.exceptions.declared.on.test.method.problem.descriptor"); } @@ -35,8 +34,7 @@ public final class MultipleExceptionsDeclaredOnTestMethodInspection extends Base extends PsiUpdateModCommandQuickFix { @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return CommonQuickFixBundle.message("fix.replace.with.x", "throws Exception"); } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/ParameterizedParametersStaticCollectionInspection.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/ParameterizedParametersStaticCollectionInspection.java index b47516382e01..1cd270df5fe1 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/ParameterizedParametersStaticCollectionInspection.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/ParameterizedParametersStaticCollectionInspection.java @@ -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.execution.junit.codeInspection; import com.intellij.codeInsight.AnnotationUtil; @@ -80,22 +80,19 @@ public final class ParameterizedParametersStaticCollectionInspection extends Bas } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return JUnitBundle.message("fix.data.provider.signature.fix.name", infos[0]); } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return JUnitBundle.message("fix.data.provider.signature.family.name"); } }; } @Override - @NotNull - protected String buildErrorString(Object... infos) { + protected @NotNull String buildErrorString(Object... infos) { if (infos.length == 0) { return JUnitBundle.message("fix.data.provider.multiple.methods.problem"); } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/UseOfObsoleteAssertInspection.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/UseOfObsoleteAssertInspection.java index 9dd5969caf51..18f9ee9a3857 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/UseOfObsoleteAssertInspection.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/UseOfObsoleteAssertInspection.java @@ -16,9 +16,9 @@ package com.intellij.execution.junit.codeInspection; import com.intellij.codeInspection.CleanupLocalInspectionTool; +import com.intellij.codeInspection.LocalQuickFix; import com.intellij.execution.JUnitBundle; import com.intellij.modcommand.ModPsiUpdater; -import com.intellij.codeInspection.LocalQuickFix; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; @@ -37,8 +37,7 @@ import org.jetbrains.annotations.Nullable; public final class UseOfObsoleteAssertInspection extends BaseInspection implements CleanupLocalInspectionTool { @Override - @NotNull - protected String buildErrorString(Object... infos) { + protected @NotNull String buildErrorString(Object... infos) { String name = (String)infos[0]; return JUnitBundle.message("use.of.obsolete.assert.problem.descriptor", name); } @@ -198,8 +197,7 @@ public final class UseOfObsoleteAssertInspection extends BaseInspection implemen return proceed[0]; } - @Nullable - private static PsiImportStaticStatement staticallyImported(PsiClass oldAssertClass, PsiReferenceExpression methodExpression) { + private static @Nullable PsiImportStaticStatement staticallyImported(PsiClass oldAssertClass, PsiReferenceExpression methodExpression) { final String referenceName = methodExpression.getReferenceName(); final PsiFile containingFile = methodExpression.getContainingFile(); if (!(containingFile instanceof PsiJavaFile)) { @@ -232,9 +230,8 @@ public final class UseOfObsoleteAssertInspection extends BaseInspection implemen return null; } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return JUnitBundle.message("use.of.obsolete.assert.quickfix"); } } diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestClassNamingConvention.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestClassNamingConvention.java index 4d11f1794805..6ccb9b3b2747 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestClassNamingConvention.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestClassNamingConvention.java @@ -30,7 +30,7 @@ public final class TestClassNamingConvention extends NamingConvention private static final int DEFAULT_MIN_LENGTH = 5; private static final int DEFAULT_MAX_LENGTH = 255; - @NonNls public static final String TEST_CLASS_NAMING_CONVENTION_SHORT_NAME = "JUnitTestClassNamingConvention"; + public static final @NonNls String TEST_CLASS_NAMING_CONVENTION_SHORT_NAME = "JUnitTestClassNamingConvention"; @Override public NamingConventionBean createDefaultBean() { diff --git a/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestSuiteNamingConvention.java b/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestSuiteNamingConvention.java index 233089061262..b3b32c32a760 100644 --- a/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestSuiteNamingConvention.java +++ b/plugins/junit/src/com/intellij/execution/junit/codeInspection/naming/TestSuiteNamingConvention.java @@ -29,7 +29,7 @@ public final class TestSuiteNamingConvention extends NamingConvention private static final int DEFAULT_MIN_LENGTH = 8; private static final int DEFAULT_MAX_LENGTH = 64; - @NonNls public static final String TEST_SUITE_NAMING_CONVENTION_SHORT_NAME = "TestSuiteNamingConvention"; + public static final @NonNls String TEST_SUITE_NAMING_CONVENTION_SHORT_NAME = "TestSuiteNamingConvention"; @Override public NamingConventionBean createDefaultBean() { diff --git a/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfigurationProducer.java b/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfigurationProducer.java index 2debcb2901d7..92550989c780 100644 --- a/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfigurationProducer.java +++ b/plugins/junit/src/com/intellij/execution/junit/testDiscovery/JUnitTestDiscoveryConfigurationProducer.java @@ -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.execution.junit.testDiscovery; import com.intellij.execution.JavaTestConfigurationBase; @@ -23,9 +23,8 @@ import java.util.*; import java.util.stream.Collectors; public final class JUnitTestDiscoveryConfigurationProducer extends TestDiscoveryConfigurationProducer { - @NotNull @Override - public ConfigurationFactory getConfigurationFactory() { + public @NotNull ConfigurationFactory getConfigurationFactory() { return JUnitConfigurationType.getInstance().getConfigurationFactories()[0]; } @@ -48,12 +47,11 @@ public final class JUnitTestDiscoveryConfigurationProducer extends TestDiscovery return JUnitUtil.isTestMethod(testMethod); } - @NotNull @Override - public RunProfileState createProfile(Location @NotNull [] testMethods, - Module module, - RunConfiguration configuration, - ExecutionEnvironment environment) { + public @NotNull RunProfileState createProfile(Location @NotNull [] testMethods, + Module module, + RunConfiguration configuration, + ExecutionEnvironment environment) { JUnitConfiguration.Data data = ((JUnitConfiguration)configuration).getPersistentData(); data.setPatterns(collectMethodPatterns(testMethods)); data.TEST_OBJECT = JUnitConfiguration.TEST_PATTERN; diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index 5ec79a501b8e..e81b533f3576 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -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.execution.junit2.configuration; @@ -295,7 +295,7 @@ public class JUnitConfigurable extends SettingsEdi } @Override - public void applyEditorTo(@NotNull final JUnitConfiguration configuration) { + public void applyEditorTo(final @NotNull JUnitConfiguration configuration) { configuration.setRepeatMode((String)myRepeatCb.getSelectedItem()); try { configuration.setRepeatCount(Integer.parseInt(myRepeatCountField.getText())); @@ -336,7 +336,7 @@ public class JUnitConfigurable extends SettingsEdi } @Override - public void resetEditorFrom(@NotNull final JUnitConfiguration configuration) { + public void resetEditorFrom(final @NotNull JUnitConfiguration configuration) { final int count = configuration.getRepeatCount(); myRepeatCountField.setText(String.valueOf(count)); myRepeatCountField.setEnabled(count > 1); @@ -403,8 +403,7 @@ public class JUnitConfigurable extends SettingsEdi myForkCb.setSelectedItem(updateForkMethod(selectedType, (String)myForkCb.getSelectedItem(), myRepeatCb.getSelectedItem())); } - @NotNull - public static String updateForkMethod(Integer selectedType, String forkMethod, Object repeat) { + public static @NotNull String updateForkMethod(Integer selectedType, String forkMethod, Object repeat) { if (forkMethod == null) { forkMethod = JUnitConfiguration.FORK_NONE; } @@ -501,8 +500,7 @@ public class JUnitConfigurable extends SettingsEdi myShortenClasspathModeCombo = new LabeledComponent<>(); } - @NotNull - public static JavaCodeFragment.VisibilityChecker createClassVisibilityChecker(TestClassBrowser classBrowser) { + public static @NotNull JavaCodeFragment.VisibilityChecker createClassVisibilityChecker(TestClassBrowser classBrowser) { return new JavaCodeFragment.VisibilityChecker() { @Override public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) { @@ -574,8 +572,7 @@ public class JUnitConfigurable extends SettingsEdi } @Override - @NotNull - public JComponent createEditor() { + public @NotNull JComponent createEditor() { return myWholePanel; } diff --git a/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java b/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java index 35a9585fe9be..9968246a8270 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java +++ b/plugins/junit/src/com/intellij/execution/junit2/inspection/JUnitEntryPoint.java @@ -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.execution.junit2.inspection; @@ -29,8 +29,7 @@ public final class JUnitEntryPoint extends EntryPointWithVisibilityLevel { public boolean ADD_JUNIT_TO_ENTRIES = true; @Override - @NotNull - public String getDisplayName() { + public @NotNull String getDisplayName() { return JUnitBundle.message("unused.declaration.junit.test.entry.point"); } diff --git a/plugins/junit/src/com/intellij/execution/junit2/refactoring/JUnit5Migration.java b/plugins/junit/src/com/intellij/execution/junit2/refactoring/JUnit5Migration.java index ac93ca0a0a0f..cf487c5b62da 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/refactoring/JUnit5Migration.java +++ b/plugins/junit/src/com/intellij/execution/junit2/refactoring/JUnit5Migration.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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.execution.junit2.refactoring; import com.intellij.execution.JUnitBundle; @@ -25,9 +11,8 @@ import java.net.URL; public final class JUnit5Migration implements PredefinedMigrationProvider { - @NotNull @Override - public URL getMigrationMap() { + public @NotNull URL getMigrationMap() { return JUnit5Migration.class.getResource("JUnit4__5.xml"); } diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/properties/JUnitConsoleProperties.java b/plugins/junit/src/com/intellij/execution/junit2/ui/properties/JUnitConsoleProperties.java index 180daa010f18..866d1ca3de59 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/properties/JUnitConsoleProperties.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/properties/JUnitConsoleProperties.java @@ -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.execution.junit2.ui.properties; import com.intellij.execution.Executor; @@ -40,9 +26,8 @@ public class JUnitConsoleProperties extends JavaAwareTestConsoleProperties getDiscoveredTests(@NotNull Project project, - @NotNull List> classesAndMethods, - byte frameworkId) { + public @NotNull MultiMap getDiscoveredTests(@NotNull Project project, + @NotNull List> classesAndMethods, + byte frameworkId) { MultiMap result = new MultiMap<>(); TestDiscoveryIndex instance = TestDiscoveryIndex.getInstance(project); classesAndMethods.forEach(couple -> result.putAllValues(couple.second == null ? @@ -22,9 +21,8 @@ final class LocalTestDiscoveryProducer implements TestDiscoveryProducer { return result; } - @NotNull @Override - public MultiMap getDiscoveredTestsForFiles(@NotNull Project project, @NotNull List paths, byte frameworkId) { + public @NotNull MultiMap getDiscoveredTestsForFiles(@NotNull Project project, @NotNull List paths, byte frameworkId) { MultiMap result = new MultiMap<>(); TestDiscoveryIndex instance = TestDiscoveryIndex.getInstance(project); for (String path : paths) { @@ -33,9 +31,8 @@ final class LocalTestDiscoveryProducer implements TestDiscoveryProducer { return result; } - @NotNull @Override - public List getAffectedFilePaths(@NotNull Project project, @NotNull List> testFqns, byte frameworkId) { + public @NotNull List getAffectedFilePaths(@NotNull Project project, @NotNull List> testFqns, byte frameworkId) { TestDiscoveryIndex instance = TestDiscoveryIndex.getInstance(project); Set result = new HashSet<>(); for (Couple test : testFqns) { @@ -44,15 +41,13 @@ final class LocalTestDiscoveryProducer implements TestDiscoveryProducer { return new ArrayList<>(result); } - @NotNull @Override - public List getAffectedFilePathsByClassName(@NotNull Project project, @NotNull String testClassName, byte frameworkId) { + public @NotNull List getAffectedFilePathsByClassName(@NotNull Project project, @NotNull String testClassName, byte frameworkId) { return Collections.emptyList(); } - @NotNull @Override - public List getFilesWithoutTests(@NotNull Project project, @NotNull Collection paths) { + public @NotNull List getFilesWithoutTests(@NotNull Project project, @NotNull Collection paths) { return Collections.emptyList(); // todo[batkovich]: implement, please } diff --git a/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEditorOptions.java b/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEditorOptions.java index 589e16d89e72..215229877ffb 100644 --- a/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEditorOptions.java +++ b/plugins/kotlin/base/code-insight/minimal/src/org/jetbrains/kotlin/idea/editor/KotlinEditorOptions.java @@ -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 org.jetbrains.kotlin.idea.editor; @@ -64,8 +64,7 @@ public class KotlinEditorOptions implements PersistentStateComponent modulesOverridingProjectSettings) { + private static @NotNull @NlsSafe String buildOverridingModulesWarning(List modulesOverridingProjectSettings) { int nameCountToShow = calculateNameCountToShowInWarning(modulesOverridingProjectSettings); int allNamesCount = modulesOverridingProjectSettings.size(); if (nameCountToShow == 0) { @@ -267,8 +265,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { return builder.toString(); } - @NotNull - private static @Nls + @Nls + private static @NotNull String getModuleKindDescription(@Nullable String moduleKind) { if (moduleKind == null) return ""; String result = moduleKindDescriptions.get(moduleKind); @@ -276,8 +274,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { return result; } - @NotNull - private static @Nls + @Nls + private static @NotNull String getSourceMapSourceEmbeddingDescription(@Nullable String sourceMapSourceEmbeddingId) { if (sourceMapSourceEmbeddingId == null) return ""; String result = sourceMapSourceEmbeddingDescriptions.get(sourceMapSourceEmbeddingId); @@ -286,16 +284,14 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { return result; } - @NotNull - private static @NlsSafe String getModuleKindOrDefault(@Nullable String moduleKindId) { + private static @NotNull @NlsSafe String getModuleKindOrDefault(@Nullable String moduleKindId) { if (moduleKindId == null) { moduleKindId = K2JsArgumentConstants.MODULE_PLAIN; } return moduleKindId; } - @NotNull - private static @NlsSafe String getSourceMapSourceEmbeddingOrDefault(@Nullable String sourceMapSourceEmbeddingId) { + private static @NotNull @NlsSafe String getSourceMapSourceEmbeddingOrDefault(@Nullable String sourceMapSourceEmbeddingId) { if (sourceMapSourceEmbeddingId == null) { sourceMapSourceEmbeddingId = K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING; } @@ -570,15 +566,13 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { sourceMapEmbedSources.setRenderer(BuilderKt.textListCellRenderer("", o -> getSourceMapSourceEmbeddingDescription(o))); } - @NotNull @Override - public String getId() { + public @NotNull String getId() { return "project.kotlinCompiler"; } - @Nullable @Override - public JComponent createComponent() { + public @Nullable JComponent createComponent() { if (validatorsDisposable != null) { LOG.error(new IllegalStateException("validatorsDisposable is not null. Disposing and rewriting it.")); Disposer.dispose(validatorsDisposable); @@ -616,8 +610,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { !getSelectedJvmVersion().equals(getJvmVersionOrDefault(k2jvmCompilerArguments.getJvmTarget())); } - @NotNull - private String getSelectedModuleKind() { + private @NotNull String getSelectedModuleKind() { return getModuleKindOrDefault((String) moduleKindComboBox.getSelectedItem()); } @@ -625,19 +618,16 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { return getSourceMapSourceEmbeddingOrDefault((String) sourceMapEmbedSources.getSelectedItem()); } - @NotNull - public String getSelectedJvmVersion() { + public @NotNull String getSelectedJvmVersion() { return getJvmVersionOrDefault((String) jvmVersionComboBox.getSelectedItem()); } - @NotNull - public VersionView getSelectedLanguageVersionView() { + public @NotNull VersionView getSelectedLanguageVersionView() { Object item = languageVersionComboBox.getSelectedItem(); return item != null ? (VersionView) item : getLatestStableVersion(); } - @NotNull - private VersionView getSelectedAPIVersionView() { + private @NotNull VersionView getSelectedAPIVersionView() { Object item = apiVersionComboBox.getSelectedItem(); return item != null ? (VersionView) item : getLatestStableVersion(); } @@ -816,9 +806,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable { return KotlinBaseCompilerConfigurationUiBundle.message("configuration.name.kotlin.compiler"); } - @Nullable @Override - public String getHelpTopic() { + public @Nullable String getHelpTopic() { return "reference.compiler.kotlin"; } diff --git a/plugins/kotlin/base/fe10/analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/MemberMatching.java b/plugins/kotlin/base/fe10/analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/MemberMatching.java index 49c145b01952..cbc3d0dfd416 100644 --- a/plugins/kotlin/base/fe10/analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/MemberMatching.java +++ b/plugins/kotlin/base/fe10/analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/MemberMatching.java @@ -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 org.jetbrains.kotlin.idea.decompiler.navigation; @@ -11,16 +11,14 @@ import java.util.List; public final class MemberMatching { /* DECLARATIONS ROUGH MATCHING */ - @Nullable - private static KtTypeReference getReceiverType(@NotNull KtNamedDeclaration propertyOrFunction) { + private static @Nullable KtTypeReference getReceiverType(@NotNull KtNamedDeclaration propertyOrFunction) { if (propertyOrFunction instanceof KtCallableDeclaration) { return ((KtCallableDeclaration) propertyOrFunction).getReceiverTypeReference(); } throw new IllegalArgumentException("Not a callable declaration: " + propertyOrFunction.getClass().getName()); } - @NotNull - private static List getValueParameters(@NotNull KtNamedDeclaration propertyOrFunction) { + private static @NotNull List getValueParameters(@NotNull KtNamedDeclaration propertyOrFunction) { if (propertyOrFunction instanceof KtCallableDeclaration) { return ((KtCallableDeclaration) propertyOrFunction).getValueParameters(); } diff --git a/plugins/kotlin/base/fe10/code-insight/src/org/jetbrains/kotlin/idea/KotlinDescriptorIconProvider.java b/plugins/kotlin/base/fe10/code-insight/src/org/jetbrains/kotlin/idea/KotlinDescriptorIconProvider.java index 29cdf3552420..4590cf197ddd 100644 --- a/plugins/kotlin/base/fe10/code-insight/src/org/jetbrains/kotlin/idea/KotlinDescriptorIconProvider.java +++ b/plugins/kotlin/base/fe10/code-insight/src/org/jetbrains/kotlin/idea/KotlinDescriptorIconProvider.java @@ -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 org.jetbrains.kotlin.idea; @@ -23,8 +23,7 @@ public final class KotlinDescriptorIconProvider { private KotlinDescriptorIconProvider() { } - @Nullable - public static Icon getIcon(@NotNull DeclarationDescriptor descriptor, @Nullable PsiElement declaration, @Iconable.IconFlags int flags) { + public static @Nullable Icon getIcon(@NotNull DeclarationDescriptor descriptor, @Nullable PsiElement declaration, @Iconable.IconFlags int flags) { if (declaration != null && !(declaration instanceof KtElement)) { return declaration.getIcon(flags); } diff --git a/plugins/kotlin/base/fe10/obsolete-compat/src/org/jetbrains/kotlin/idea/core/quickfix/QuickFixUtil.java b/plugins/kotlin/base/fe10/obsolete-compat/src/org/jetbrains/kotlin/idea/core/quickfix/QuickFixUtil.java index 888aee5f7f76..089ac79acc1b 100644 --- a/plugins/kotlin/base/fe10/obsolete-compat/src/org/jetbrains/kotlin/idea/core/quickfix/QuickFixUtil.java +++ b/plugins/kotlin/base/fe10/obsolete-compat/src/org/jetbrains/kotlin/idea/core/quickfix/QuickFixUtil.java @@ -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 org.jetbrains.kotlin.idea.core.quickfix; import com.intellij.psi.PsiFile; @@ -19,9 +19,8 @@ public final class QuickFixUtil { /** * @deprecated Avoid using unsafe resolution methods and unwrapping 'DeferredType's. */ - @Nullable @Deprecated - public static KotlinType getDeclarationReturnType(KtNamedDeclaration declaration) { + public static @Nullable KotlinType getDeclarationReturnType(KtNamedDeclaration declaration) { PsiFile file = declaration.getContainingFile(); if (!(file instanceof KtFile)) return null; DeclarationDescriptor descriptor = ResolutionUtils.unsafeResolveToDescriptor(declaration, BodyResolveMode.FULL); diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceLeafValueClassNode.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceLeafValueClassNode.java index f4de6afb1999..e9a899f27503 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceLeafValueClassNode.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceLeafValueClassNode.java @@ -15,8 +15,7 @@ import javax.swing.*; import java.util.ArrayList; public class HackedSliceLeafValueClassNode extends SliceLeafValueRootNode { - @NlsSafe - private final String myClassName; + private final @NlsSafe String myClassName; HackedSliceLeafValueClassNode(@NotNull Project project, @NotNull SliceNode root, @NotNull String className) { super(project, diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceNullnessAnalyzerBase.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceNullnessAnalyzerBase.java index 46dca0a92a07..346dfb77db66 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceNullnessAnalyzerBase.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/slicer/HackedSliceNullnessAnalyzerBase.java @@ -23,11 +23,9 @@ import org.jetbrains.kotlin.idea.codeInsight.KotlinCodeInsightBundle; import java.util.*; public abstract class HackedSliceNullnessAnalyzerBase { - @NotNull - private final SliceLeafEquality myLeafEquality; + private final @NotNull SliceLeafEquality myLeafEquality; - @NotNull - private final SliceLanguageSupportProvider myProvider; + private final @NotNull SliceLanguageSupportProvider myProvider; public HackedSliceNullnessAnalyzerBase(@NotNull SliceLeafEquality leafEquality, @NotNull SliceLanguageSupportProvider provider) { @@ -49,8 +47,7 @@ public abstract class HackedSliceNullnessAnalyzerBase { "slice.nullness.tab.title.grouped.by.nullness"))); } - @NotNull - public SliceRootNode createNewTree(NullAnalysisResult result, SliceRootNode oldRoot, final Map map) { + public @NotNull SliceRootNode createNewTree(NullAnalysisResult result, SliceRootNode oldRoot, final Map map) { SliceRootNode root = oldRoot.copy(); assert oldRoot.getCachedChildren().size() == 1; SliceNode oldRootStart = oldRoot.getCachedChildren().get(0); @@ -119,7 +116,7 @@ public abstract class HackedSliceNullnessAnalyzerBase { root.getProject(), KotlinCodeInsightBundle.message("slice.nullness.progress.title.expanding.all.nodes"), true) { @Override - public void run(@NotNull final ProgressIndicator indicator) { + public void run(final @NotNull ProgressIndicator indicator) { NullAnalysisResult l = calcNullableLeaves(root, treeStructure, map); leafExpressions.set(l); } @@ -155,14 +152,14 @@ public abstract class HackedSliceNullnessAnalyzerBase { return nulls.get(node).groupedByValue[group]; } - @NotNull - public NullAnalysisResult calcNullableLeaves(@NotNull final SliceNode root, + public @NotNull NullAnalysisResult calcNullableLeaves( + final @NotNull SliceNode root, @NotNull AbstractTreeStructure treeStructure, - @NotNull final Map map) { + final @NotNull Map map) { final SliceLeafAnalyzer.SliceNodeGuide guide = new SliceLeafAnalyzer.SliceNodeGuide(treeStructure); WalkingState walkingState = new WalkingState<>(guide) { @Override - public void visit(@NotNull final SliceNode element) { + public void visit(final @NotNull SliceNode element) { element.calculateDupNode(); node(element, map).clear(); SliceNode duplicate = element.getDuplicate(); @@ -205,8 +202,7 @@ public abstract class HackedSliceNullnessAnalyzerBase { * @param element element to find nullability for * @return element nullability */ - @NotNull - protected Nullability checkNullability(final PsiElement element) { + protected @NotNull Nullability checkNullability(final PsiElement element) { throw new UnsupportedOperationException(); } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/expression/KotlinStringTemplateSurrounder.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/expression/KotlinStringTemplateSurrounder.java index a3467e8ada16..7ec5c881c194 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/expression/KotlinStringTemplateSurrounder.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/expression/KotlinStringTemplateSurrounder.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.surroundWith.expression; @@ -11,9 +11,8 @@ import org.jetbrains.kotlin.idea.codeInsight.surroundWith.KotlinExpressionSurrou import org.jetbrains.kotlin.psi.*; public class KotlinStringTemplateSurrounder extends KotlinExpressionSurrounder { - @NlsSafe @Override - public String getTemplateDescription() { + public @NlsSafe String getTemplateDescription() { return "\"${expr}\""; } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfElseSurrounder.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfElseSurrounder.java index 6b512488469c..416acc3d60fa 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfElseSurrounder.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfElseSurrounder.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement; @@ -14,9 +14,8 @@ public class KotlinIfElseSurrounder extends KotlinIfSurrounderBase { return CodeInsightBundle.message("surround.with.ifelse.template"); } - @NotNull @Override - protected String getCodeTemplate() { + protected @NotNull String getCodeTemplate() { return "if (a) { \n} else { \n}"; } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounder.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounder.java index 2eeda0f46d86..b644e0481fc9 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounder.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounder.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement; @@ -13,9 +13,8 @@ public class KotlinIfSurrounder extends KotlinIfSurrounderBase { return CodeInsightBundle.message("surround.with.if.template"); } - @NotNull @Override - protected String getCodeTemplate() { + protected @NotNull String getCodeTemplate() { return "if (a) { \n}"; } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java index 02d693f82788..eda5b226bff4 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement; @@ -57,8 +57,7 @@ public abstract class KotlinIfSurrounderBase extends KotlinStatementsSurrounder condition.delete(); } - @NotNull - protected abstract String getCodeTemplate(); + protected abstract @NotNull String getCodeTemplate(); protected abstract boolean isGenerateDefaultInitializers(); } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinComponentUnwrapper.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinComponentUnwrapper.java index d21139bdc435..d99046d96333 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinComponentUnwrapper.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinComponentUnwrapper.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.unwrap; @@ -14,11 +14,9 @@ public abstract class KotlinComponentUnwrapper extends KotlinUnwrapRemoveBase { super(key); } - @Nullable - protected abstract KtExpression getExpressionToUnwrap(@NotNull KtElement target); + protected abstract @Nullable KtExpression getExpressionToUnwrap(@NotNull KtElement target); - @NotNull - protected KtElement getEnclosingElement(@NotNull KtElement element) { + protected @NotNull KtElement getEnclosingElement(@NotNull KtElement element) { return element; } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinUnwrappers.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinUnwrappers.java index baa1639a6f42..32e77fce109a 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinUnwrappers.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/unwrap/KotlinUnwrappers.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.unwrap; @@ -71,8 +71,7 @@ public class KotlinUnwrappers { } @Override - @Nullable - protected KtExpression getExpressionToUnwrap(@NotNull KtElement target) { + protected @Nullable KtExpression getExpressionToUnwrap(@NotNull KtElement target) { return target instanceof KtLoopExpression ? ((KtLoopExpression) target).getBody() : null; } } @@ -83,8 +82,7 @@ public class KotlinUnwrappers { } @Override - @Nullable - protected KtExpression getExpressionToUnwrap(@NotNull KtElement target) { + protected @Nullable KtExpression getExpressionToUnwrap(@NotNull KtElement target) { return target instanceof KtTryExpression ? ((KtTryExpression) target).getTryBlock() : null; } } @@ -94,9 +92,8 @@ public class KotlinUnwrappers { super(key); } - @NotNull @Override - protected KtElement getEnclosingElement(@NotNull KtElement element) { + protected @NotNull KtElement getEnclosingElement(@NotNull KtElement element) { return (KtElement)element.getParent(); } @@ -127,9 +124,8 @@ public class KotlinUnwrappers { return super.isApplicableTo(e) && getEnclosingElement((KtElement)e).getParent() instanceof KtBlockExpression; } - @NotNull @Override - protected KtElement getEnclosingElement(@NotNull KtElement element) { + protected @NotNull KtElement getEnclosingElement(@NotNull KtElement element) { return (KtElement)element.getParent(); } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/AbstractKotlinUpDownMover.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/AbstractKotlinUpDownMover.java index 1b5b170652b0..29de350f2222 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/AbstractKotlinUpDownMover.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/AbstractKotlinUpDownMover.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.upDownMover; @@ -31,8 +31,7 @@ public abstract class AbstractKotlinUpDownMover extends LineMover { @NotNull LineRange oldRange ); - @Nullable - protected LineRange getSourceRange( + protected @Nullable LineRange getSourceRange( @NotNull PsiElement firstElement, @NotNull PsiElement lastElement, @NotNull Editor editor, @@ -131,8 +130,7 @@ public abstract class AbstractKotlinUpDownMover extends LineMover { return lastElement; } - @Nullable - protected static KtAnnotationEntry getParentFileAnnotationEntry(@Nullable PsiElement element) { + protected static @Nullable KtAnnotationEntry getParentFileAnnotationEntry(@Nullable PsiElement element) { if (element == null) return null; KtAnnotationEntry annotationEntry = PsiTreeUtil.getParentOfType(element, KtAnnotationEntry.class); @@ -152,18 +150,15 @@ public abstract class AbstractKotlinUpDownMover extends LineMover { return PsiTreeUtil.isAncestor(block, blockElement, true) && comment instanceof PsiComment; } - @Nullable - protected static PsiElement getSiblingOfType(@NotNull PsiElement element, boolean down, @NotNull Class type) { + protected static @Nullable PsiElement getSiblingOfType(@NotNull PsiElement element, boolean down, @NotNull Class type) { return down ? PsiTreeUtil.getNextSiblingOfType(element, type) : PsiTreeUtil.getPrevSiblingOfType(element, type); } - @Nullable - protected static PsiElement firstNonWhiteSibling(@NotNull LineRange lineRange, boolean down) { + protected static @Nullable PsiElement firstNonWhiteSibling(@NotNull LineRange lineRange, boolean down) { return firstNonWhiteElement(down ? lineRange.lastElement.getNextSibling() : lineRange.firstElement.getPrevSibling(), down); } - @Nullable - protected static PsiElement firstNonWhiteSibling(@NotNull PsiElement element, boolean down) { + protected static @Nullable PsiElement firstNonWhiteSibling(@NotNull PsiElement element, boolean down) { return firstNonWhiteElement(down ? element.getNextSibling() : element.getPrevSibling(), down); } diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/KotlinDeclarationMover.java b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/KotlinDeclarationMover.java index 7abe2b103dac..3e0c64748b9d 100644 --- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/KotlinDeclarationMover.java +++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeInsight/upDownMover/KotlinDeclarationMover.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight.upDownMover; @@ -84,8 +84,7 @@ public class KotlinDeclarationMover extends AbstractKotlinUpDownMover { } } - @NotNull - private static List getDeclarationAnchors(@NotNull KtDeclaration declaration) { + private static @NotNull List getDeclarationAnchors(@NotNull KtDeclaration declaration) { final List memberSuspects = new ArrayList<>(); KtModifierList modifierList = declaration.getModifierList(); @@ -146,8 +145,7 @@ public class KotlinDeclarationMover extends AbstractKotlinUpDownMover { private static final Class[] CLASSBODYLIKE_DECLARATION_CONTAINER_CLASSES = {KtClassBody.class, KtFile.class}; - @Nullable - private static KtDeclaration getMovableDeclaration(@Nullable PsiElement element) { + private static @Nullable KtDeclaration getMovableDeclaration(@Nullable PsiElement element) { if (element == null) return null; if (getParentFileAnnotationEntry(element) != null) return null; @@ -227,8 +225,7 @@ public class KotlinDeclarationMover extends AbstractKotlinUpDownMover { return null; } - @Nullable - private static LineRange getTargetRange( + private static @Nullable LineRange getTargetRange( @NotNull Editor editor, @NotNull PsiElement sibling, boolean down, @@ -289,8 +286,7 @@ public class KotlinDeclarationMover extends AbstractKotlinUpDownMover { return sibling.getNode().getElementType() == (down ? KtTokens.RBRACE : KtTokens.LBRACE); } - @Nullable - private static KtClassBody getClassBody(PsiElement element) { + private static @Nullable KtClassBody getClassBody(PsiElement element) { if (element instanceof KtClassOrObject) { return ((KtClassOrObject) element).getBody(); } else { diff --git a/plugins/kotlin/code-insight/live-templates-shared/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java b/plugins/kotlin/code-insight/live-templates-shared/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java index 21752299dad7..5ec19b00a617 100644 --- a/plugins/kotlin/code-insight/live-templates-shared/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java +++ b/plugins/kotlin/code-insight/live-templates-shared/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java @@ -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 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 org.jetbrains.kotlin.idea.liveTemplates; @@ -61,9 +61,8 @@ public abstract class KotlinTemplateContextType extends TemplateContextType { return element != null && isInContext(element); } - @Nullable @Override - public SyntaxHighlighter createHighlighter() { + public @Nullable SyntaxHighlighter createHighlighter() { return new KotlinHighlighter(); } diff --git a/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/stubindex/IdeStubIndexService.java b/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/stubindex/IdeStubIndexService.java index ec8506ec45f1..838469868427 100644 --- a/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/stubindex/IdeStubIndexService.java +++ b/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/stubindex/IdeStubIndexService.java @@ -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 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 org.jetbrains.kotlin.idea.stubindex; @@ -156,8 +156,7 @@ public class IdeStubIndexService extends StubIndexService { } } - @Nullable - private static KotlinModifierListStub getModifierListStub(@NotNull KotlinStubWithFqName stub) { + private static @Nullable KotlinModifierListStub getModifierListStub(@NotNull KotlinStubWithFqName stub) { return stub.findChildStubByType(KtStubElementTypes.MODIFIER_LIST); } @@ -295,9 +294,8 @@ public class IdeStubIndexService extends StubIndexService { sink.occurrence(KotlinScriptFqnIndex.Helper.getIndexKey(), stub.getFqName().asString()); } - @NotNull @Override - public KotlinFileStub createFileStub(@NotNull KtFile file) { + public @NotNull KotlinFileStub createFileStub(@NotNull KtFile file) { String packageFqName =file.getPackageFqNameByTree().asString(); boolean isScript = file.isScriptByTree(); if (file.hasTopLevelCallables()) { @@ -331,9 +329,8 @@ public class IdeStubIndexService extends StubIndexService { } } - @NotNull @Override - public KotlinFileStub deserializeFileStub(@NotNull StubInputStream dataStream) throws IOException { + public @NotNull KotlinFileStub deserializeFileStub(@NotNull StubInputStream dataStream) throws IOException { String packageFqNameAsString = dataStream.readNameString(); if (packageFqNameAsString == null) { throw new IllegalStateException("Can't read package fqname from stream"); diff --git a/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java b/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java index 1b1170bd01ca..6c58b14cf3b4 100644 --- a/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java +++ b/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java @@ -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 org.jetbrains.kotlin.idea.core.formatter; import com.intellij.configurationStore.Property; @@ -16,15 +16,9 @@ import org.jetbrains.kotlin.idea.formatter.KotlinOfficialStyleGuide; import org.jetbrains.kotlin.idea.util.ReflectionUtil; public class KotlinCodeStyleSettings extends CustomCodeStyleSettings { - @NotNull - @ReflectionUtil.SkipInEquals - @Property(externalName = "packages_to_use_import_on_demand") - public KotlinPackageEntryTable PACKAGES_TO_USE_STAR_IMPORTS = new KotlinPackageEntryTable(); + @ReflectionUtil.SkipInEquals @Property(externalName = "packages_to_use_import_on_demand") public @NotNull KotlinPackageEntryTable PACKAGES_TO_USE_STAR_IMPORTS = new KotlinPackageEntryTable(); - @NotNull - @ReflectionUtil.SkipInEquals - @Property(externalName = "imports_layout") - public KotlinPackageEntryTable PACKAGES_IMPORT_LAYOUT = new KotlinPackageEntryTable(); + @ReflectionUtil.SkipInEquals @Property(externalName = "imports_layout") public @NotNull KotlinPackageEntryTable PACKAGES_IMPORT_LAYOUT = new KotlinPackageEntryTable(); public static final int DEFAULT_NAME_COUNT_TO_USE_STAR_IMPORT = 5; public static final int DEFAULT_NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS = 3; diff --git a/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/formatter/NodeAlignmentStrategy.java b/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/formatter/NodeAlignmentStrategy.java index 275f8c81ee54..bc73d596b308 100644 --- a/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/formatter/NodeAlignmentStrategy.java +++ b/plugins/kotlin/formatter/minimal/src/org/jetbrains/kotlin/idea/formatter/NodeAlignmentStrategy.java @@ -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 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 org.jetbrains.kotlin.idea.formatter; @@ -22,8 +22,7 @@ public abstract class NodeAlignmentStrategy extends CommonAlignmentStrategy { } @Override - @Nullable - public abstract Alignment getAlignment(@NotNull ASTNode node); + public abstract @Nullable Alignment getAlignment(@NotNull ASTNode node); private static class AlignmentStrategyWrapper extends NodeAlignmentStrategy { private final AlignmentStrategy internalStrategy; @@ -32,9 +31,8 @@ public abstract class NodeAlignmentStrategy extends CommonAlignmentStrategy { this.internalStrategy = internalStrategy; } - @Nullable @Override - public Alignment getAlignment(@NotNull ASTNode node) { + public @Nullable Alignment getAlignment(@NotNull ASTNode node) { ASTNode parent = node.getTreeParent(); if (parent != null) { return internalStrategy.getAlignment(parent.getElementType(), node.getElementType()); diff --git a/plugins/kotlin/gradle/gradle/src/org/jetbrains/kotlin/idea/gradle/inspections/KotlinGradleModelFacade.java b/plugins/kotlin/gradle/gradle/src/org/jetbrains/kotlin/idea/gradle/inspections/KotlinGradleModelFacade.java index a9f7150c3daf..828e8b986a59 100644 --- a/plugins/kotlin/gradle/gradle/src/org/jetbrains/kotlin/idea/gradle/inspections/KotlinGradleModelFacade.java +++ b/plugins/kotlin/gradle/gradle/src/org/jetbrains/kotlin/idea/gradle/inspections/KotlinGradleModelFacade.java @@ -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 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 org.jetbrains.kotlin.idea.gradle.inspections; @@ -15,8 +15,7 @@ import java.util.List; public interface KotlinGradleModelFacade { ExtensionPointName EP_NAME = ExtensionPointName.create("org.jetbrains.kotlin.gradleModelFacade"); - @Nullable - default String getResolvedVersionByModuleData( + default @Nullable String getResolvedVersionByModuleData( @NotNull DataNode moduleData, @NotNull String groupId, @NotNull List libraryIds diff --git a/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/codeInsight/KtFunctionPsiElementCellRenderer.java b/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/codeInsight/KtFunctionPsiElementCellRenderer.java index b0cc869a0217..c24eebef2c9c 100644 --- a/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/codeInsight/KtFunctionPsiElementCellRenderer.java +++ b/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/codeInsight/KtFunctionPsiElementCellRenderer.java @@ -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 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 org.jetbrains.kotlin.idea.codeInsight; @@ -23,9 +23,8 @@ public class KtFunctionPsiElementCellRenderer extends PsiTargetPresentationRende return super.getElementText(element); } - @NotNull @Override - public TargetPresentation getPresentation(@NotNull PsiElement element) { + public @NotNull TargetPresentation getPresentation(@NotNull PsiElement element) { return TargetPresentation.builder(getElementText(element)) .containerText(SymbolPresentationUtil.getSymbolContainerText(element)) .icon(getIcon(element)) diff --git a/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/HtmlTabledDescriptorRenderer.java b/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/HtmlTabledDescriptorRenderer.java index eb98dff2a42d..d8e1db8cd43b 100644 --- a/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/HtmlTabledDescriptorRenderer.java +++ b/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/HtmlTabledDescriptorRenderer.java @@ -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 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 org.jetbrains.kotlin.idea.highlighter; @@ -32,9 +32,8 @@ import static org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.Co import static org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPositionKind.VALUE_PARAMETER_POSITION; public class HtmlTabledDescriptorRenderer extends TabledDescriptorRenderer { - @NotNull @Override - public DiagnosticParameterRenderer getTypeRenderer() { + public @NotNull DiagnosticParameterRenderer getTypeRenderer() { return IdeRenderers.HTML_RENDER_TYPE; } diff --git a/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java b/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java index 8b3c7fc529f6..cdac6aa2908c 100644 --- a/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java +++ b/plugins/kotlin/highlighting/highlighting-k1/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java @@ -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 org.jetbrains.kotlin.idea.highlighter; @@ -29,9 +29,7 @@ public final class IdeErrorMessages { private static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap("IDE"); // TODO: i18n - @NlsSafe - @NotNull - public static String render(@NotNull UnboundDiagnostic diagnostic) { + public static @NlsSafe @NotNull String render(@NotNull UnboundDiagnostic diagnostic) { DiagnosticRenderer renderer = MAP.get(diagnostic.getFactory()); if (renderer != null) { diff --git a/plugins/kotlin/highlighting/highlighting-minimal/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlighter.java b/plugins/kotlin/highlighting/highlighting-minimal/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlighter.java index b9b8cf63f215..6e3cfe7b7b24 100644 --- a/plugins/kotlin/highlighting/highlighting-minimal/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlighter.java +++ b/plugins/kotlin/highlighting/highlighting-minimal/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlighter.java @@ -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 org.jetbrains.kotlin.idea.highlighter; @@ -20,8 +20,7 @@ public class KotlinHighlighter extends SyntaxHighlighterBase { private static final Map keys2; @Override - @NotNull - public Lexer getHighlightingLexer() { + public @NotNull Lexer getHighlightingLexer() { return new KotlinHighlightingLexer(); } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/KotlinIdeaBundle.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/KotlinIdeaBundle.java index aeaf0d62c2ae..5f16ff450c54 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/KotlinIdeaBundle.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/KotlinIdeaBundle.java @@ -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 org.jetbrains.kotlin.idea; import com.intellij.DynamicBundle; @@ -14,8 +14,8 @@ public final class KotlinIdeaBundle { private KotlinIdeaBundle() { } - public static @Nls - @NotNull String message( + @Nls + public static @NotNull String message( @PropertyKey(resourceBundle = BUNDLE_FQN) @NotNull String key, @Nullable Object @NotNull ... params ) { diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/actions/generate/ToStringMemberChooserHeaderPanel.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/actions/generate/ToStringMemberChooserHeaderPanel.java index c7767d093c54..729d20abf2e8 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/actions/generate/ToStringMemberChooserHeaderPanel.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/actions/generate/ToStringMemberChooserHeaderPanel.java @@ -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 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 org.jetbrains.kotlin.idea.actions.generate; @@ -21,9 +21,8 @@ public class ToStringMemberChooserHeaderPanel extends JPanel { comboBox = new ComboBox(KotlinGenerateToStringAction.Generator.values()); comboBox.setRenderer( new DefaultListCellRenderer() { - @NotNull @Override - public Component getListCellRendererComponent( + public @NotNull Component getListCellRendererComponent( JList list, Object value, int index, diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixBranchUtil.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixBranchUtil.java index b194cebfbd91..5a5890c9f337 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixBranchUtil.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixBranchUtil.java @@ -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 org.jetbrains.kotlin.idea.quickfix; @@ -15,8 +15,7 @@ final class QuickFixBranchUtil { private QuickFixBranchUtil() { } - @Nullable - static KotlinType findLowerBoundOfOverriddenCallablesReturnTypes(@NotNull CallableDescriptor descriptor) { + static @Nullable KotlinType findLowerBoundOfOverriddenCallablesReturnTypes(@NotNull CallableDescriptor descriptor) { KotlinType matchingReturnType = null; for (CallableDescriptor overriddenDescriptor : descriptor.getOverriddenDescriptors()) { KotlinType overriddenReturnType = overriddenDescriptor.getReturnType(); @@ -39,8 +38,7 @@ final class QuickFixBranchUtil { PsiTreeUtil.getNextSiblingOfType(expression, KtExpression.class) == null; } - @Nullable - static KtIfExpression getParentIfForBranch(@Nullable KtExpression expression) { + static @Nullable KtIfExpression getParentIfForBranch(@Nullable KtExpression expression) { KtIfExpression ifExpression = PsiTreeUtil.getParentOfType(expression, KtIfExpression.class, true); if (ifExpression == null) return null; if (equalOrLastInBlock(ifExpression.getThen(), expression) @@ -50,8 +48,7 @@ final class QuickFixBranchUtil { return null; } - @Nullable - private static KtWhenExpression getParentWhenForBranch(@Nullable KtExpression expression) { + private static @Nullable KtWhenExpression getParentWhenForBranch(@Nullable KtExpression expression) { KtWhenEntry whenEntry = PsiTreeUtil.getParentOfType(expression, KtWhenEntry.class, true); if (whenEntry == null) return null; KtExpression whenEntryExpression = whenEntry.getExpression(); @@ -60,8 +57,7 @@ final class QuickFixBranchUtil { return PsiTreeUtil.getParentOfType(whenEntry, KtWhenExpression.class, true); } - @Nullable - private static KtExpression getParentForBranch(@Nullable KtExpression expression) { + private static @Nullable KtExpression getParentForBranch(@Nullable KtExpression expression) { KtExpression parent = getParentIfForBranch(expression); if (parent != null) return parent; return getParentWhenForBranch(expression); diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractFunction/ui/KotlinExtractFunctionDialog.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractFunction/ui/KotlinExtractFunctionDialog.java index e13a554d1e4a..d0b885a5c2f8 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractFunction/ui/KotlinExtractFunctionDialog.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractFunction/ui/KotlinExtractFunctionDialog.java @@ -1,9 +1,7 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. 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 org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.ui; -import com.intellij.openapi.application.ModalityState; -import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.util.NlsSafe; @@ -11,17 +9,14 @@ import com.intellij.psi.PsiElement; import com.intellij.refactoring.ui.NameSuggestionsField; import com.intellij.ui.TitledSeparator; import com.intellij.util.ArrayUtil; -import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.containers.MultiMap; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.base.resources.KotlinBundle; import org.jetbrains.kotlin.idea.KotlinFileType; -import org.jetbrains.kotlin.idea.core.KotlinPluginDisposable; -import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtilKt; +import org.jetbrains.kotlin.idea.base.resources.KotlinBundle; import org.jetbrains.kotlin.idea.refactoring.introduce.extractionEngine.*; import org.jetbrains.kotlin.idea.refactoring.introduce.ui.KotlinSignatureComponent; import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers; @@ -89,8 +84,7 @@ public class KotlinExtractFunctionDialog extends DialogWrapper { return KtPsiUtilKt.quoteIfNeeded(functionNameField.getEnteredName()); } - @Nullable - private KtModifierKeywordToken getVisibility() { + private @Nullable KtModifierKeywordToken getVisibility() { if (!isVisibilitySectionAvailable()) return null; KtModifierKeywordToken value = (KtModifierKeywordToken) visibilityBox.getSelectedItem(); @@ -135,9 +129,8 @@ public class KotlinExtractFunctionDialog extends DialogWrapper { returnTypeBox.setModel(returnTypeBoxModel); returnTypeBox.setRenderer( new DefaultListCellRenderer() { - @NotNull @Override - public Component getListCellRendererComponent( + public @NotNull Component getListCellRendererComponent( JList list, Object value, int index, @@ -255,14 +248,12 @@ public class KotlinExtractFunctionDialog extends DialogWrapper { return contentPane; } - @NotNull @Override - protected JComponent createContentPane() { + protected @NotNull JComponent createContentPane() { return contentPane; } - @NotNull - private ExtractableCodeDescriptor createDescriptor() { + private @NotNull ExtractableCodeDescriptor createDescriptor() { return createNewDescriptor(originalDescriptor.getDescriptor(), getFunctionName(), getVisibility(), @@ -271,8 +262,7 @@ public class KotlinExtractFunctionDialog extends DialogWrapper { (KotlinType) returnTypeBox.getSelectedItem()); } - @NotNull - public ExtractionGeneratorConfiguration getCurrentConfiguration() { + public @NotNull ExtractionGeneratorConfiguration getCurrentConfiguration() { return new ExtractionGeneratorConfiguration(currentDescriptor, ExtractionGeneratorOptions.DEFAULT); } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceTypeAlias/ui/KotlinIntroduceTypeAliasDialog.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceTypeAlias/ui/KotlinIntroduceTypeAliasDialog.java index 5150ce8f2914..6d68093164c6 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceTypeAlias/ui/KotlinIntroduceTypeAliasDialog.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceTypeAlias/ui/KotlinIntroduceTypeAliasDialog.java @@ -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 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 org.jetbrains.kotlin.idea.refactoring.introduce.introduceTypeAlias.ui; @@ -14,9 +14,8 @@ import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.base.resources.KotlinBundle; import org.jetbrains.kotlin.idea.KotlinFileType; -import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtilKt; +import org.jetbrains.kotlin.idea.base.resources.KotlinBundle; import org.jetbrains.kotlin.idea.refactoring.introduce.introduceTypeAlias.IntroduceTypeAliasDescriptor; import org.jetbrains.kotlin.idea.refactoring.introduce.introduceTypeAlias.IntroduceTypeAliasImplKt; import org.jetbrains.kotlin.idea.refactoring.introduce.introduceTypeAlias.KotlinIntroduceTypeAliasHandler; @@ -76,8 +75,7 @@ public class KotlinIntroduceTypeAliasDialog extends DialogWrapper { return !getApplicableVisibilities().isEmpty(); } - @NotNull - private List getApplicableVisibilities() { + private @NotNull List getApplicableVisibilities() { return IntroduceTypeAliasImplKt.getApplicableVisibilities(originalDescriptor.getOriginalData()); } @@ -85,8 +83,7 @@ public class KotlinIntroduceTypeAliasDialog extends DialogWrapper { return KtPsiUtilKt.quoteIfNeeded(aliasNameField.getEnteredName()); } - @Nullable - private KtModifierKeywordToken getVisibility() { + private @Nullable KtModifierKeywordToken getVisibility() { if (!isVisibilitySectionAvailable()) return null; return (KtModifierKeywordToken) visibilityBox.getSelectedItem(); } @@ -213,14 +210,12 @@ public class KotlinIntroduceTypeAliasDialog extends DialogWrapper { return contentPane; } - @NotNull @Override - protected JComponent createContentPane() { + protected @NotNull JComponent createContentPane() { return contentPane; } - @NotNull - private IntroduceTypeAliasDescriptor createDescriptor() { + private @NotNull IntroduceTypeAliasDescriptor createDescriptor() { return originalDescriptor.copy( originalDescriptor.getOriginalData(), getAliasName(), diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesDialog.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesDialog.java index 4fe303d3ac6e..bd84d554bc80 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesDialog.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesDialog.java @@ -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 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 org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.ui; @@ -56,8 +56,7 @@ public class MoveKotlinNestedClassesDialog extends RefactoringDialog { private KotlinMemberSelectionTable memberTable; private PsiElement targetClass; - @Nullable - private PsiDirectory targetDirectory; + private @Nullable PsiDirectory targetDirectory; private GlobalSearchScope searchScope; public MoveKotlinNestedClassesDialog( @@ -119,9 +118,8 @@ public class MoveKotlinNestedClassesDialog extends RefactoringDialog { null, true ) { - @Nullable @Override - protected PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) { + protected @Nullable PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) { PsiClass psiClass = super.getSelectedFromTreeUserObject(node); if (psiClass != null) return psiClass; diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesToUpperLevelDialog.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesToUpperLevelDialog.java index d6c0bef4b19e..c41757650c6f 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesToUpperLevelDialog.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/MoveKotlinNestedClassesToUpperLevelDialog.java @@ -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 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 org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.ui; @@ -43,7 +43,7 @@ import java.util.Collections; import java.util.List; public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase { - @NonNls private static final String RECENTS_KEY = MoveKotlinNestedClassesToUpperLevelDialog.class.getName() + ".RECENTS_KEY"; + private static final @NonNls String RECENTS_KEY = MoveKotlinNestedClassesToUpperLevelDialog.class.getName() + ".RECENTS_KEY"; private final Project project; private final KtClassOrObject innerClass; @@ -105,8 +105,7 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase { return classNameField.getText().trim(); } - @Nullable - public String getParameterName() { + public @Nullable String getParameterName() { return parameterField != null ? parameterField.getEnteredName() : null; } @@ -114,13 +113,11 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase { return innerClass instanceof KtClass && MoveUtilKt.traverseOuterInstanceReferences(innerClass, true); } - @Nullable - private FqName getTargetPackageFqName() { + private @Nullable FqName getTargetPackageFqName() { return MoveUtilKt.getTargetPackageFqName(targetContainer); } - @NotNull - private KotlinType getOuterInstanceType() { + private @NotNull KotlinType getOuterInstanceType() { return ((ClassDescriptor) innerClassDescriptor.getContainingDeclaration()).getDefaultType(); } @@ -235,9 +232,8 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase { isOpenInEditor); } - @Nullable @Override - protected VirtualFile chooseSourceRoot( + protected @Nullable VirtualFile chooseSourceRoot( @NotNull PackageWrapper newPackage, @NotNull List contentSourceRoots, @Nullable PsiDirectory initialDir diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveMethod/MoveKotlinMethodDialog.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveMethod/MoveKotlinMethodDialog.java index 476d58b4a858..696e0fd27a67 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveMethod/MoveKotlinMethodDialog.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveMethod/MoveKotlinMethodDialog.java @@ -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 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 org.jetbrains.kotlin.idea.refactoring.move.moveMethod; @@ -39,8 +39,8 @@ import org.jetbrains.kotlin.types.KotlinType; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import java.awt.*; -import java.util.List; import java.util.*; +import java.util.List; import static org.jetbrains.kotlin.name.Name.isValidIdentifier; @@ -110,9 +110,8 @@ public class MoveKotlinMethodDialog extends RefactoringDialog { invokeRefactoring(processor); } - @Nullable @Override - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return mainPanel; } @@ -288,9 +287,8 @@ public class MoveKotlinMethodDialog extends RefactoringDialog { null, true ) { - @Nullable @Override - protected PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) { + protected @Nullable PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) { PsiClass psiClass = super.getSelectedFromTreeUserObject(node); if (psiClass != null) return psiClass; Object userObject = node.getUserObject(); diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/safeDelete/KotlinOverridingDialog.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/safeDelete/KotlinOverridingDialog.java index 52a89347ae16..99cab72bbecb 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/safeDelete/KotlinOverridingDialog.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/safeDelete/KotlinOverridingDialog.java @@ -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 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 org.jetbrains.kotlin.idea.refactoring.safeDelete; @@ -73,8 +73,7 @@ class KotlinOverridingDialog extends DialogWrapper { return "#org.jetbrains.kotlin.idea.refactoring.safeDelete.KotlinOverridingDialog"; } - @NotNull - public List getSelected() { + public @NotNull List getSelected() { List result = new ArrayList<>(); for (int i = 0; i < myChecked.length; i++) { if (myChecked[i]) { @@ -84,9 +83,8 @@ class KotlinOverridingDialog extends DialogWrapper { return result; } - @NotNull @Override - protected Action[] createActions() { + protected @NotNull Action[] createActions() { return new Action[] {getOKAction(), getCancelAction()}; } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java index cb749c5bffae..b03a34d7a652 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java @@ -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 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 org.jetbrains.kotlin.idea.script.configuration; import com.intellij.openapi.options.ConfigurationException; @@ -46,9 +46,8 @@ public class KotlinScriptingSettingsConfigurable implements SearchableConfigurab model = KotlinScriptDefinitionsModel.Companion.createModel(getAllDefinitions(project), settings); } - @Nullable @Override - public JComponent createComponent() { + public @Nullable JComponent createComponent() { panelScriptDefinitionsChooser.setLayout(new VerticalLayout(0)); panelScriptDefinitionsChooser.add(new TitledSeparator(KotlinBundle.message("kotlin.script.definitions.title"))); @@ -139,8 +138,7 @@ public class KotlinScriptingSettingsConfigurable implements SearchableConfigurab } @Override - @NotNull - public String getId() { + public @NotNull String getId() { return ID; } } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/util/LongRunningReadTask.java b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/util/LongRunningReadTask.java index 89fd8f7af1d7..7603002e8d14 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/util/LongRunningReadTask.java +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/util/LongRunningReadTask.java @@ -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 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 org.jetbrains.kotlin.idea.util; @@ -144,8 +144,7 @@ public abstract class LongRunningReadTask { * Executed in GUI Thread. */ @SuppressWarnings("UnusedParameters") - @NotNull - protected RequestInfo cloneRequestInfo(@NotNull RequestInfo requestInfo) { + protected @NotNull RequestInfo cloneRequestInfo(@NotNull RequestInfo requestInfo) { RequestInfo cloneRequestInfo = prepareRequestInfo(); if (cloneRequestInfo == null) { throw new IllegalStateException("Cloned request object can't be null"); @@ -159,8 +158,7 @@ public abstract class LongRunningReadTask { * * @return null if current request is invalid and task shouldn't be executed. */ - @Nullable - protected abstract RequestInfo prepareRequestInfo(); + protected abstract @Nullable RequestInfo prepareRequestInfo(); /** * Executed in GUI Thread. @@ -175,8 +173,7 @@ public abstract class LongRunningReadTask { /** * Executed in thread pool under read lock with write priority. */ - @Nullable - protected abstract ResultData processRequest(@NotNull RequestInfo requestInfo); + protected abstract @Nullable ResultData processRequest(@NotNull RequestInfo requestInfo); /** * Executed in GUI Thread. Do nothing by default. @@ -190,9 +187,9 @@ public abstract class LongRunningReadTask { * */ public static void runWithWriteActionPriority( - @NotNull final ProgressIndicator indicator, + final @NotNull ProgressIndicator indicator, @NotNull Disposable parentDisposable, - @NotNull final Runnable action + final @NotNull Runnable action ) { Disposable disposable = Disposer.newDisposable(); Disposer.register(parentDisposable, disposable); diff --git a/plugins/kotlin/j2k/shared/src/org/jetbrains/kotlin/j2k/copyPaste/KotlinPasteFromJavaDialog.java b/plugins/kotlin/j2k/shared/src/org/jetbrains/kotlin/j2k/copyPaste/KotlinPasteFromJavaDialog.java index 4d8291f8b9b3..198d8070b4ee 100644 --- a/plugins/kotlin/j2k/shared/src/org/jetbrains/kotlin/j2k/copyPaste/KotlinPasteFromJavaDialog.java +++ b/plugins/kotlin/j2k/shared/src/org/jetbrains/kotlin/j2k/copyPaste/KotlinPasteFromJavaDialog.java @@ -42,9 +42,8 @@ public class KotlinPasteFromJavaDialog extends DialogWrapper { return panel; } - @NotNull @Override - protected Action @NotNull [] createActions() { + protected @NotNull Action @NotNull [] createActions() { setOKButtonText(CommonBundle.getYesButtonText()); setCancelButtonText(CommonBundle.getNoButtonText()); return new Action[] {getOKAction(), getCancelAction()}; diff --git a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinDelegatedPropertyRendererConfigurableUi.java b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinDelegatedPropertyRendererConfigurableUi.java index a954542dc3d0..de3e5194dbbb 100644 --- a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinDelegatedPropertyRendererConfigurableUi.java +++ b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/KotlinDelegatedPropertyRendererConfigurableUi.java @@ -28,9 +28,8 @@ public class KotlinDelegatedPropertyRendererConfigurableUi implements Configurab settings.setDebugDisableCoroutineAgent(!disableCoroutineAgent.isSelected()); } - @NotNull @Override - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return myPanel; } } diff --git a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/breakpoints/KotlinBreakpointFiltersPanel.java b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/breakpoints/KotlinBreakpointFiltersPanel.java index 750b8bf447d4..39a5e8ae980e 100644 --- a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/breakpoints/KotlinBreakpointFiltersPanel.java +++ b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/breakpoints/KotlinBreakpointFiltersPanel.java @@ -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 org.jetbrains.kotlin.idea.debugger.core.breakpoints; import com.intellij.debugger.InstanceFilter; @@ -114,9 +114,8 @@ public class KotlinBreakpointFiltersPanel s, String glue, int N, String nthGlue) { + private static @NlsSafe StringBuilder concatWithEx(StringBuilder builder, List s, String glue, int N, String nthGlue) { int i = 1; for (Iterator iterator = s.iterator(); iterator.hasNext(); i++) { String str = iterator.next(); diff --git a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSteppingConfigurableUi.java b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSteppingConfigurableUi.java index 9c85a4dfa5e6..0e8adf137027 100644 --- a/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSteppingConfigurableUi.java +++ b/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/stepping/KotlinSteppingConfigurableUi.java @@ -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 org.jetbrains.kotlin.idea.debugger.core.stepping; @@ -32,9 +32,8 @@ public class KotlinSteppingConfigurableUi implements ConfigurableUi classesRoots) { + public @Nullable LibraryVersionProperties detect(@NotNull List classesRoots) { IdeKotlinVersion version = KotlinJvmStdlibDetectorFacility.INSTANCE.getStdlibVersion(classesRoots); return version == null ? null : new LibraryVersionProperties(version.getArtifactVersion()); } diff --git a/plugins/kotlin/jvm/src/org/jetbrains/kotlin/idea/framework/KotlinModuleSettingStep.java b/plugins/kotlin/jvm/src/org/jetbrains/kotlin/idea/framework/KotlinModuleSettingStep.java index 47a472a53f46..d8db19751316 100644 --- a/plugins/kotlin/jvm/src/org/jetbrains/kotlin/idea/framework/KotlinModuleSettingStep.java +++ b/plugins/kotlin/jvm/src/org/jetbrains/kotlin/idea/framework/KotlinModuleSettingStep.java @@ -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 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 org.jetbrains.kotlin.idea.framework; @@ -17,7 +17,6 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModifiableRootModel; -import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription; import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer; import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory; @@ -33,11 +32,11 @@ import kotlin.jvm.functions.Function1; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.idea.KotlinJvmBundle; +import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle; +import org.jetbrains.kotlin.idea.formatter.ProjectCodeStyleImporter; import org.jetbrains.kotlin.idea.projectConfiguration.CustomLibraryDescriptionWithDeferredConfig; import org.jetbrains.kotlin.idea.projectConfiguration.JSLibraryStdDescription; import org.jetbrains.kotlin.idea.projectConfiguration.JavaRuntimeLibraryDescription; -import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle; -import org.jetbrains.kotlin.idea.formatter.ProjectCodeStyleImporter; import org.jetbrains.kotlin.platform.JsPlatformKt; import org.jetbrains.kotlin.platform.TargetPlatform; import org.jetbrains.kotlin.platform.jvm.JvmPlatformKt; @@ -52,8 +51,7 @@ public class KotlinModuleSettingStep extends ModuleWizardStep { private final TargetPlatform targetPlatform; - @Nullable - private final ModuleWizardStep myJavaStep; + private final @Nullable ModuleWizardStep myJavaStep; private final CustomLibraryDescription customLibraryDescription; private final LibrariesContainer librariesContainer; @@ -125,16 +123,13 @@ public class KotlinModuleSettingStep extends ModuleWizardStep { return panel; } - @NlsContexts.BorderTitle - @NotNull - protected String getLibraryLabelText() { + protected @NlsContexts.BorderTitle @NotNull String getLibraryLabelText() { if (JvmPlatformKt.isJvm(targetPlatform)) return KotlinJvmBundle.message("library.label.jvm"); if (JsPlatformKt.isJs(targetPlatform)) return KotlinJvmBundle.message("library.label.javascript"); throw new IllegalStateException("Only JS and JVM target are supported"); } - @NotNull - protected CustomLibraryDescription getCustomLibraryDescription(@Nullable Project project) { + protected @NotNull CustomLibraryDescription getCustomLibraryDescription(@Nullable Project project) { if (JvmPlatformKt.isJvm(targetPlatform)) return new JavaRuntimeLibraryDescription(project); if (JsPlatformKt.isJs(targetPlatform)) return new JSLibraryStdDescription(project); throw new IllegalStateException("Only JS and JVM target are supported"); diff --git a/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindClassUsagesDialog.java b/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindClassUsagesDialog.java index 27fae6027401..0ccbf7fe92e9 100644 --- a/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindClassUsagesDialog.java +++ b/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindClassUsagesDialog.java @@ -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 org.jetbrains.kotlin.idea.base.searching.usages.dialogs; @@ -49,8 +49,7 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog { private static final Key ORIGINAL_CLASS = Key.create("ORIGINAL_CLASS"); - @NotNull - private static PsiClass getRepresentingPsiClass(@NotNull KtClassOrObject classOrObject) { + private static @NotNull PsiClass getRepresentingPsiClass(@NotNull KtClassOrObject classOrObject) { PsiClass lightClass = toLightClass(classOrObject); if (lightClass != null) return lightClass; @@ -125,14 +124,12 @@ public class KotlinFindClassUsagesDialog extends FindClassUsagesDialog { return findWhatPanel; } - @NotNull @Override - protected KotlinClassFindUsagesOptions getFindUsagesOptions() { + protected @NotNull KotlinClassFindUsagesOptions getFindUsagesOptions() { return (KotlinClassFindUsagesOptions) super.getFindUsagesOptions(); } - @Nullable - private KtClassOrObject getOriginalClass() { + private @Nullable KtClassOrObject getOriginalClass() { PsiElement klass = LightClassUtilsKt.getUnwrapped(getPsiElement()); if (klass == null) { return null; diff --git a/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindPropertyUsagesDialog.java b/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindPropertyUsagesDialog.java index 894683156c83..c78be579219e 100644 --- a/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindPropertyUsagesDialog.java +++ b/plugins/kotlin/kotlin.searching/base/src/org/jetbrains/kotlin/idea/base/searching/usages/dialogs/KotlinFindPropertyUsagesDialog.java @@ -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 org.jetbrains.kotlin.idea.base.searching.usages.dialogs; @@ -44,9 +44,8 @@ public class KotlinFindPropertyUsagesDialog extends JavaFindUsagesDialog DO_NOTHING = __ -> {}; protected static final class ControlWrapper { - @NotNull - private final Function0 factory; - @NotNull - private final Function0 condition; - @NotNull - private final Consumer initializer; + private final @NotNull Function0 factory; + private final @NotNull Function0 condition; + private final @NotNull Consumer initializer; private JComponent component; public ControlWrapper( @@ -89,8 +89,7 @@ public abstract class AbstractKotlinInplaceVariableIntroducer panelControls = new ArrayList<>(); private JPanel contentPanel; @@ -139,13 +138,11 @@ public abstract class AbstractKotlinInplaceVariableIntroducer getCreateExplicitTypeCheckBox() { + protected final @Nullable Function0 getCreateExplicitTypeCheckBox() { if (myExprType == null || noTypeInference) return null; return new Function0<>() { @@ -230,8 +225,7 @@ public abstract class AbstractKotlinInplaceVariableIntroducer getCreateVarCheckBox() { + protected final @Nullable Function0 getCreateVarCheckBox() { if (myDoNotChangeVar) return null; return new Function0<>() { @@ -440,8 +434,7 @@ public abstract class AbstractKotlinInplaceVariableIntroducer messagePointer(@NotNull @PropertyKey(resourceBundle = PATH_TO_BUNDLE) String key, - Object @NotNull ... params) { + public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = PATH_TO_BUNDLE) String key, + Object @NotNull ... params) { return ourInstance.getLazyMessage(key, params); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/Version.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/Version.java index e0bdbd29faee..1fbc1f9650fa 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/Version.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/Version.java @@ -31,8 +31,7 @@ public interface Version { } } - @Nullable - static String parseLombokVersion(@Nullable OrderEntry orderEntry) { + static @Nullable String parseLombokVersion(@Nullable OrderEntry orderEntry) { String result = null; if (orderEntry != null) { final String presentableName = orderEntry.getPresentableName(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/AbstractDelombokAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/AbstractDelombokAction.java index 28fe941ac8e2..1899b26ce883 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/AbstractDelombokAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/AbstractDelombokAction.java @@ -77,7 +77,7 @@ public abstract class AbstractDelombokAction extends AnAction { } } - private void processDirectory(@NotNull final Project project, @NotNull VirtualFile vFile) { + private void processDirectory(final @NotNull Project project, @NotNull VirtualFile vFile) { VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() { @Override public boolean visitFile(@NotNull VirtualFile file) { @@ -99,11 +99,11 @@ public abstract class AbstractDelombokAction extends AnAction { } } - protected void process(@NotNull final Project project, @NotNull final PsiJavaFile psiJavaFile) { + protected void process(final @NotNull Project project, final @NotNull PsiJavaFile psiJavaFile) { executeCommand(project, () -> getHandler().invoke(project, psiJavaFile)); } - protected void process(@NotNull final Project project, @NotNull final PsiFile psiFile, @NotNull final PsiClass psiClass) { + protected void process(final @NotNull Project project, final @NotNull PsiFile psiFile, final @NotNull PsiClass psiClass) { executeCommand(project, () -> getHandler().invoke(project, psiFile, psiClass)); } @@ -166,8 +166,7 @@ public abstract class AbstractDelombokAction extends AnAction { return ContainerUtil.exists(classesIntern, this::isValidForClass); } - @Nullable - private static PsiClass getTargetClass(Editor editor, PsiFile file) { + private static @Nullable PsiClass getTargetClass(Editor editor, PsiFile file) { int offset = editor.getCaretModel().getOffset(); PsiElement element = file.findElementAt(offset); if (element == null) { @@ -192,8 +191,7 @@ public abstract class AbstractDelombokAction extends AnAction { return targetClass != null && isValidForClass(targetClass); } - @NlsContexts.Command - private String getCommandName() { + private @NlsContexts.Command String getCommandName() { String text = getTemplatePresentation().getText(); return text == null ? "" : text; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokBuilderAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokBuilderAction.java index 205463916b65..3b7436303887 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokBuilderAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokBuilderAction.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokBuilderAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler(true, manager.getBuilderPreDefinedInnerClassFieldProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokConstructorAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokConstructorAction.java index 5fb843e33bc9..d6191794d457 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokConstructorAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokConstructorAction.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokConstructorAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler( manager.getAllArgsConstructorProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDataAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDataAction.java index cf66ca20fbd2..36a338c894cd 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDataAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDataAction.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokDataAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { return new DelombokHandler(LombokProcessorManager.getInstance().getDataProcessor()); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDelegateAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDelegateAction.java index 616d0349c088..52624dd520bc 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDelegateAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokDelegateAction.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; public class DelombokDelegateAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler( manager.getDelegateFieldProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokFieldNameConstantsAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokFieldNameConstantsAction.java index c7f5c29f383b..d90729f839c1 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokFieldNameConstantsAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokFieldNameConstantsAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokFieldNameConstantsAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler(true, manager.getFieldNameConstantsOldProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokGetterAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokGetterAction.java index 7d5feb177982..5461eb173e17 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokGetterAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokGetterAction.java @@ -6,8 +6,7 @@ import org.jetbrains.annotations.NotNull; public class DelombokGetterAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler( manager.getGetterProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokHandler.java index a92d361963fc..852ddb710ae0 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokHandler.java @@ -311,8 +311,7 @@ public class DelombokHandler { } } - @NotNull - private static String getTypeParameterAsString(@NotNull PsiTypeParameter typeParameter) { + private static @NotNull String getTypeParameterAsString(@NotNull PsiTypeParameter typeParameter) { final PsiClassType[] referencedTypes = typeParameter.getExtendsList().getReferencedTypes(); String extendsText = ""; if (referencedTypes.length > 0) { @@ -322,8 +321,7 @@ public class DelombokHandler { return typeParameter.getName() + extendsText; } - @NotNull - private static String getTypeWithParameter(@NotNull PsiClassType psiClassType) { + private static @NotNull String getTypeWithParameter(@NotNull PsiClassType psiClassType) { if (psiClassType instanceof PsiClassReferenceType) { return ((PsiClassReferenceType)psiClassType).getReference().getText(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokLoggerAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokLoggerAction.java index f57a46fc50c4..bc0eabc6d6a0 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokLoggerAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokLoggerAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public class DelombokLoggerAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler( manager.getCommonsLogProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSetterAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSetterAction.java index 2162e3d9b0f6..fac8c46988f8 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSetterAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSetterAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokSetterAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler( manager.getSetterProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokStandardExceptionAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokStandardExceptionAction.java index 21e15f8519d6..b144a58b1771 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokStandardExceptionAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokStandardExceptionAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokStandardExceptionAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { return new DelombokHandler(true, LombokProcessorManager.getInstance().getStandardExceptionProcessor()); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSuperBuilderAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSuperBuilderAction.java index 543d03d01f63..a89f2f6a3738 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSuperBuilderAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokSuperBuilderAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokSuperBuilderAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler(true, manager.getSuperBuilderPreDefinedInnerClassFieldProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokToStringAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokToStringAction.java index 3045af501560..b46680867e41 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokToStringAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokToStringAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public class DelombokToStringAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { return new DelombokHandler(LombokProcessorManager.getInstance().getToStringProcessor()); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokUtilityClassAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokUtilityClassAction.java index f6decc8dad46..13b6e08e1954 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokUtilityClassAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokUtilityClassAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokUtilityClassAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { return new DelombokHandler(true, LombokProcessorManager.getInstance().getUtilityClassProcessor()); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokValueAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokValueAction.java index c1efbcb2b8f6..9cc4ac09226e 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokValueAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokValueAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public final class DelombokValueAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { return new DelombokHandler(LombokProcessorManager.getInstance().getValueProcessor()); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokWitherAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokWitherAction.java index 946593707daa..d1f04ff42a78 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokWitherAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/delombok/DelombokWitherAction.java @@ -5,8 +5,7 @@ import org.jetbrains.annotations.NotNull; public class DelombokWitherAction extends AbstractDelombokAction { @Override - @NotNull - protected DelombokHandler createHandler() { + protected @NotNull DelombokHandler createHandler() { LombokProcessorManager manager = LombokProcessorManager.getInstance(); return new DelombokHandler( manager.getWitherProcessor(), diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokElementFinder.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokElementFinder.java index 954a88ab2715..0083bbd60610 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokElementFinder.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokElementFinder.java @@ -20,9 +20,8 @@ public final class LombokElementFinder extends PsiElementFinder { myProject = project; } - @Nullable @Override - public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) { + public @Nullable PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) { if (!LombokLibraryUtil.hasLombokLibrary(myProject) && !DumbIncompleteModeUtil.isIncompleteMode(myProject)) { return null; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokLightMethodTreeGenerator.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokLightMethodTreeGenerator.java index 18e0eaef722e..5157d8361bf4 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokLightMethodTreeGenerator.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokLightMethodTreeGenerator.java @@ -19,8 +19,7 @@ public final class LombokLightMethodTreeGenerator implements TreeGenerator { } @Override - @Nullable - public TreeElement generateTreeFor(PsiElement original, CharTable table, PsiManager manager) { + public @Nullable TreeElement generateTreeFor(PsiElement original, CharTable table, PsiManager manager) { TreeElement result = null; if (original instanceof LombokLightMethodBuilder) { result = ChangeUtil.copyElement((TreeElement) SourceTreeToPsiMap.psiElementToTree(original), table); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokReadWriteAccessDetector.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokReadWriteAccessDetector.java index e7483d5c9c41..3caa198aa303 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokReadWriteAccessDetector.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokReadWriteAccessDetector.java @@ -7,9 +7,8 @@ import de.plushnikov.intellij.plugin.psi.LombokLightMethodBuilder; import org.jetbrains.annotations.NotNull; public final class LombokReadWriteAccessDetector extends JavaReadWriteAccessDetector { - @NotNull @Override - public Access getExpressionAccess(@NotNull final PsiElement expression) { + public @NotNull Access getExpressionAccess(final @NotNull PsiElement expression) { if (expression instanceof PsiReferenceExpression psiRefExpression) { final PsiElement actualReferee = psiRefExpression.resolve(); if (actualReferee instanceof LombokLightMethodBuilder lombokMethodBuilder) { diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokRenameMethodProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokRenameMethodProcessor.java index be5ea95057fd..3f46817c5aeb 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokRenameMethodProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokRenameMethodProcessor.java @@ -21,8 +21,7 @@ public final class LombokRenameMethodProcessor extends RenamePsiElementProcessor } @Override - @Nullable - public PsiElement substituteElementToRename(@NotNull PsiElement elem, @Nullable Editor editor) { + public @Nullable PsiElement substituteElementToRename(@NotNull PsiElement elem, @Nullable Editor editor) { return elem.getNavigationElement(); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokStructureViewExtension.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokStructureViewExtension.java index dd617ac57b25..e96500ec7742 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokStructureViewExtension.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/LombokStructureViewExtension.java @@ -45,9 +45,8 @@ public final class LombokStructureViewExtension implements StructureViewExtensio .toArray(StructureViewTreeElement[]::new); } - @Nullable @Override - public Object getCurrentEditorElement(Editor editor, PsiElement parent) { + public @Nullable Object getCurrentEditorElement(Editor editor, PsiElement parent) { return null; } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/postfix/LombokPostfixTemplateProvider.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/postfix/LombokPostfixTemplateProvider.java index f0649aa9aec1..2b7b2f988701 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/postfix/LombokPostfixTemplateProvider.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/extension/postfix/LombokPostfixTemplateProvider.java @@ -22,9 +22,8 @@ public final class LombokPostfixTemplateProvider implements PostfixTemplateProvi lombokTemplates.add(new LombokVarPostfixTemplate()); } - @NotNull @Override - public Set getTemplates() { + public @NotNull Set getTemplates() { return lombokTemplates; } @@ -41,9 +40,8 @@ public final class LombokPostfixTemplateProvider implements PostfixTemplateProvi public void afterExpand(@NotNull PsiFile file, @NotNull Editor editor) { } - @NotNull @Override - public PsiFile preCheck(@NotNull PsiFile copyFile, @NotNull Editor realEditor, int currentOffset) { + public @NotNull PsiFile preCheck(@NotNull PsiFile copyFile, @NotNull Editor realEditor, int currentOffset) { Document document = copyFile.getFileDocument(); CharSequence sequence = document.getCharsSequence(); StringBuilder fileContentWithSemicolon = new StringBuilder(sequence); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/handler/BaseLombokHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/handler/BaseLombokHandler.java index fd64e20d27dd..ab1928600971 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/handler/BaseLombokHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/handler/BaseLombokHandler.java @@ -145,8 +145,7 @@ public abstract class BaseLombokHandler implements CodeInsightActionHandler { } } - @Nullable - protected PsiMethod findPublicNonStaticMethod(@NotNull PsiClass psiClass, @NotNull String methodName, @NotNull PsiType returnType, PsiType... params) { + protected @Nullable PsiMethod findPublicNonStaticMethod(@NotNull PsiClass psiClass, @NotNull String methodName, @NotNull PsiType returnType, PsiType... params) { final PsiMethod[] toStringMethods = psiClass.findMethodsByName(methodName, false); for (PsiMethod method : toStringMethods) { if (method.hasModifierProperty(PsiModifier.PUBLIC) && diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/DeprecatedLombokAnnotationInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/DeprecatedLombokAnnotationInspection.java index 18e5fe18d98d..3d1fdc970de1 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/DeprecatedLombokAnnotationInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/DeprecatedLombokAnnotationInspection.java @@ -17,9 +17,8 @@ import org.jetbrains.annotations.NotNull; */ public final class DeprecatedLombokAnnotationInspection extends LombokJavaInspectionBase { - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { return new LombokElementVisitor(holder); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterMayBeUsedInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterMayBeUsedInspection.java index e48cca7a5b00..b6331569bdcb 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterMayBeUsedInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterMayBeUsedInspection.java @@ -14,33 +14,28 @@ import java.util.List; public final class LombokGetterMayBeUsedInspection extends LombokGetterOrSetterMayBeUsedInspection { @Override - @NotNull - protected String getTagName() { + protected @NotNull String getTagName() { return "return"; } @Override - @NotNull - protected String getJavaDocMethodMarkup() { + protected @NotNull String getJavaDocMethodMarkup() { return "GETTER"; } @Override - @NotNull - protected @NonNls String getAnnotationName() { + protected @NotNull @NonNls String getAnnotationName() { return LombokClassNames.GETTER; } @Override - @NotNull - protected @Nls String getFieldErrorMessage(String fieldName) { + protected @NotNull @Nls String getFieldErrorMessage(String fieldName) { return LombokBundle.message("inspection.lombok.getter.may.be.used.display.field.message", fieldName); } @Override - @NotNull - protected @Nls String getClassErrorMessage(String className) { + protected @NotNull @Nls String getClassErrorMessage(String className) { return LombokBundle.message("inspection.lombok.getter.may.be.used.display.class.message", className); } @@ -87,14 +82,12 @@ public final class LombokGetterMayBeUsedInspection extends LombokGetterOrSetterM } @Override - @NotNull - protected @Nls String getFixName(String text) { + protected @NotNull @Nls String getFixName(String text) { return LombokBundle.message("inspection.lombok.getter.may.be.used.display.fix.name", text); } @Override - @NotNull - protected @Nls String getFixFamilyName() { + protected @NotNull @Nls String getFixFamilyName() { return LombokBundle.message("inspection.lombok.getter.may.be.used.display.fix.family.name"); } } \ No newline at end of file diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterOrSetterMayBeUsedInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterOrSetterMayBeUsedInspection.java index c0ff0a50f0bf..db63cf6c1d23 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterOrSetterMayBeUsedInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokGetterOrSetterMayBeUsedInspection.java @@ -28,9 +28,8 @@ import java.util.List; public abstract class LombokGetterOrSetterMayBeUsedInspection extends LombokJavaInspectionBase { - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { return new LombokGetterOrSetterMayBeUsedVisitor(holder, null); } @@ -130,17 +129,13 @@ public abstract class LombokGetterOrSetterMayBeUsedInspection extends LombokJava myText = text; } - @Nls(capitalization = Nls.Capitalization.Sentence) - @NotNull @Override - public String getName() { + public @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull String getName() { return getFixName(myText); } - @Nls(capitalization = Nls.Capitalization.Sentence) - @NotNull @Override - public String getFamilyName() { + public @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull String getFamilyName() { return getFixFamilyName(); } @@ -254,28 +249,21 @@ public abstract class LombokGetterOrSetterMayBeUsedInspection extends LombokJava } } - @NotNull - protected abstract String getTagName(); + protected abstract @NotNull String getTagName(); - @NotNull - protected abstract String getJavaDocMethodMarkup(); + protected abstract @NotNull String getJavaDocMethodMarkup(); - @NotNull - protected abstract @NonNls String getAnnotationName(); + protected abstract @NotNull @NonNls String getAnnotationName(); - @NotNull - protected abstract @Nls String getFieldErrorMessage(String fieldName); + protected abstract @NotNull @Nls String getFieldErrorMessage(String fieldName); - @NotNull - protected abstract @Nls String getClassErrorMessage(String className); + protected abstract @NotNull @Nls String getClassErrorMessage(String className); protected abstract boolean processMethod(@NotNull PsiMethod method, @NotNull List> instanceCandidates, @NotNull List> staticCandidates); - @NotNull - protected abstract @Nls String getFixName(String text); + protected abstract @NotNull @Nls String getFixName(String text); - @NotNull - protected abstract @Nls String getFixFamilyName(); + protected abstract @NotNull @Nls String getFixFamilyName(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokInspection.java index c4e16edf86bf..7e165c9e10e6 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokInspection.java @@ -29,9 +29,8 @@ public final class LombokInspection extends LombokJavaInspectionBase { public LombokInspection() { } - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { return new LombokElementVisitor(holder); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokJavaInspectionBase.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokJavaInspectionBase.java index a1e3831f05f0..fa1629b38dcc 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokJavaInspectionBase.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokJavaInspectionBase.java @@ -19,6 +19,5 @@ public abstract class LombokJavaInspectionBase extends AbstractBaseJavaLocalInsp return createVisitor(holder, isOnTheFly); } - @NotNull - protected abstract PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly); + protected abstract @NotNull PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokSetterMayBeUsedInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokSetterMayBeUsedInspection.java index 57d78c6c9e2f..9b02f9a19fd6 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokSetterMayBeUsedInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/LombokSetterMayBeUsedInspection.java @@ -15,33 +15,28 @@ import java.util.List; public final class LombokSetterMayBeUsedInspection extends LombokGetterOrSetterMayBeUsedInspection { @Override - @NotNull - protected String getTagName() { + protected @NotNull String getTagName() { return "param"; } @Override - @NotNull - protected String getJavaDocMethodMarkup() { + protected @NotNull String getJavaDocMethodMarkup() { return "SETTER"; } @Override - @NotNull - protected @NonNls String getAnnotationName() { + protected @NotNull @NonNls String getAnnotationName() { return LombokClassNames.SETTER; } @Override - @NotNull - protected @Nls String getFieldErrorMessage(String fieldName) { + protected @NotNull @Nls String getFieldErrorMessage(String fieldName) { return LombokBundle.message("inspection.lombok.setter.may.be.used.display.field.message", fieldName); } @Override - @NotNull - protected @Nls String getClassErrorMessage(String className) { + protected @NotNull @Nls String getClassErrorMessage(String className) { return LombokBundle.message("inspection.lombok.setter.may.be.used.display.class.message", className); } @@ -118,14 +113,12 @@ public final class LombokSetterMayBeUsedInspection extends LombokGetterOrSetterM } @Override - @NotNull - protected @Nls String getFixName(String text) { + protected @NotNull @Nls String getFixName(String text) { return LombokBundle.message("inspection.lombok.setter.may.be.used.display.fix.name", text); } @Override - @NotNull - protected @Nls String getFixFamilyName() { + protected @NotNull @Nls String getFixFamilyName() { return LombokBundle.message("inspection.lombok.setter.may.be.used.display.fix.family.name"); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/RedundantSlf4jDefinitionInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/RedundantSlf4jDefinitionInspection.java index c38f9e2336d6..7503611a150a 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/RedundantSlf4jDefinitionInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/RedundantSlf4jDefinitionInspection.java @@ -15,9 +15,8 @@ public final class RedundantSlf4jDefinitionInspection extends LombokJavaInspecti private static final String LOGGER_SLF4J_FQCN = Slf4jProcessor.LOGGER_TYPE; private static final String LOGGER_INITIALIZATION = "LoggerFactory.getLogger(%s.class)"; - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new LombokDefinitionVisitor(holder); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/SpringQualifierCopyableLombokAnnotationInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/SpringQualifierCopyableLombokAnnotationInspection.java index c1d1282f072e..e35c401bba49 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/SpringQualifierCopyableLombokAnnotationInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/SpringQualifierCopyableLombokAnnotationInspection.java @@ -1,6 +1,5 @@ package de.plushnikov.intellij.plugin.inspection; -import com.intellij.codeInspection.ProblemHighlightType; import com.intellij.codeInspection.ProblemsHolder; import com.intellij.psi.*; import de.plushnikov.intellij.plugin.LombokBundle; @@ -19,9 +18,8 @@ public final class SpringQualifierCopyableLombokAnnotationInspection extends Lom private static final String SPRING_QUALIFIER_FQN = "org.springframework.beans.factory.annotation.Qualifier"; - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { return new LombokElementVisitor(holder); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/StaticMethodImportLombokInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/StaticMethodImportLombokInspection.java index 8cb9504b2a17..88ce3f8bdeaf 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/StaticMethodImportLombokInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/StaticMethodImportLombokInspection.java @@ -13,9 +13,8 @@ import org.jetbrains.annotations.NotNull; */ public final class StaticMethodImportLombokInspection extends LombokJavaInspectionBase { - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { return new LombokElementVisitor(holder); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/LombokRedundantModifierInspection.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/LombokRedundantModifierInspection.java index 951294d83ad6..bf38dda83fb3 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/LombokRedundantModifierInspection.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/LombokRedundantModifierInspection.java @@ -22,9 +22,8 @@ public abstract class LombokRedundantModifierInspection extends LombokJavaInspec this.redundantModifiersInfo = redundantModifiersInfo; } - @NotNull @Override - protected PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { + protected @NotNull PsiElementVisitor createVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new LombokRedundantModifiersVisitor(holder); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/RedundantModifiersInfo.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/RedundantModifiersInfo.java index 11a302257bfb..6d045699d6be 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/RedundantModifiersInfo.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/inspection/modifiers/RedundantModifiersInfo.java @@ -10,7 +10,7 @@ public class RedundantModifiersInfo { private final RedundantModifiersInfoType redundantModifiersInfoType; private final String[] modifiers; - @InspectionMessage private final String description; + private final @InspectionMessage String description; private final String dontRunOnModifier; public RedundantModifiersInfo(@NotNull RedundantModifiersInfoType redundantModifiersInfoType, @@ -28,8 +28,7 @@ public class RedundantModifiersInfo { return modifiers; } - @InspectionMessage - public String getDescription() { + public @InspectionMessage String getDescription() { return description; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/from/AbstractReplaceVariableWithExplicitTypeIntentionAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/from/AbstractReplaceVariableWithExplicitTypeIntentionAction.java index 41a24d19d463..e601923c102f 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/from/AbstractReplaceVariableWithExplicitTypeIntentionAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/from/AbstractReplaceVariableWithExplicitTypeIntentionAction.java @@ -20,10 +20,8 @@ public abstract class AbstractReplaceVariableWithExplicitTypeIntentionAction ext this.variableClassName = variableClassName; } - @Nls(capitalization = Nls.Capitalization.Sentence) - @NotNull @Override - public String getFamilyName() { + public @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull String getFamilyName() { return LombokBundle.message("replace.0.with.explicit.type.lombok", StringUtil.getShortName(variableClassName)); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/to/AbstractReplaceExplicitTypeWithVariableIntentionAction.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/to/AbstractReplaceExplicitTypeWithVariableIntentionAction.java index 66547cac5dfc..2564a66214af 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/to/AbstractReplaceExplicitTypeWithVariableIntentionAction.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/intention/valvar/to/AbstractReplaceExplicitTypeWithVariableIntentionAction.java @@ -21,10 +21,8 @@ public abstract class AbstractReplaceExplicitTypeWithVariableIntentionAction ext this.variableClassName = variableClassName; } - @Nls(capitalization = Nls.Capitalization.Sentence) - @NotNull @Override - public String getFamilyName() { + public @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull String getFamilyName() { return LombokBundle.message("replace.explicit.type.with.0.lombok", StringUtil.getShortName(variableClassName)); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigColorSettingsPage.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigColorSettingsPage.java index e67f1ccf8e66..b4d5da56d7df 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigColorSettingsPage.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigColorSettingsPage.java @@ -23,21 +23,18 @@ public final class LombokConfigColorSettingsPage implements ColorSettingsPage { new AttributesDescriptor(LombokBundle.messagePointer("color.settings.value"), LombokConfigSyntaxHighlighter.VALUE), }; - @Nullable @Override - public Icon getIcon() { + public @Nullable Icon getIcon() { return LombokIcons.Config; } - @NotNull @Override - public SyntaxHighlighter getHighlighter() { + public @NotNull SyntaxHighlighter getHighlighter() { return new LombokConfigSyntaxHighlighter(); } - @NotNull @Override - public String getDemoText() { + public @NotNull String getDemoText() { return """ ## ## Key : lombok.log.fieldName @@ -52,9 +49,8 @@ public final class LombokConfigColorSettingsPage implements ColorSettingsPage { """; } - @Nullable @Override - public Map getAdditionalHighlightingTagToDescriptorMap() { + public @Nullable Map getAdditionalHighlightingTagToDescriptorMap() { return null; } @@ -68,10 +64,8 @@ public final class LombokConfigColorSettingsPage implements ColorSettingsPage { return ColorDescriptor.EMPTY_ARRAY; } - @NotNull @Override - @NlsContexts.ConfigurableName - public String getDisplayName() { + public @NotNull @NlsContexts.ConfigurableName String getDisplayName() { return LombokBundle.message("configurable.name.lombok.config"); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigCommentor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigCommentor.java index fad5715a1468..4b48e0f976fa 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigCommentor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigCommentor.java @@ -4,33 +4,28 @@ import com.intellij.lang.Commenter; import org.jetbrains.annotations.Nullable; public final class LombokConfigCommentor implements Commenter { - @Nullable @Override - public String getLineCommentPrefix() { + public @Nullable String getLineCommentPrefix() { return "#"; } - @Nullable @Override - public String getBlockCommentPrefix() { + public @Nullable String getBlockCommentPrefix() { return ""; } - @Nullable @Override - public String getBlockCommentSuffix() { + public @Nullable String getBlockCommentSuffix() { return null; } - @Nullable @Override - public String getCommentedBlockCommentPrefix() { + public @Nullable String getCommentedBlockCommentPrefix() { return null; } - @Nullable @Override - public String getCommentedBlockCommentSuffix() { + public @Nullable String getCommentedBlockCommentSuffix() { return null; } } \ No newline at end of file diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigFileType.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigFileType.java index 0a09b3ed31c2..181d50bdf3b8 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigFileType.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigFileType.java @@ -5,7 +5,6 @@ import com.intellij.openapi.util.NlsContexts; import de.plushnikov.intellij.plugin.LombokBundle; import icons.LombokIcons; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -16,22 +15,18 @@ public final class LombokConfigFileType extends LanguageFileType { super(LombokConfigLanguage.INSTANCE); } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "LOMBOK_CONFIG"; } - @NotNull @Override - @NlsContexts.Label - public String getDescription() { + public @NotNull @NlsContexts.Label String getDescription() { return LombokBundle.message("filetype.lombok.config.description"); } - @NotNull @Override - public String getDefaultExtension() { + public @NotNull String getDefaultExtension() { return "config"; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigParserDefinition.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigParserDefinition.java index 8694a60dbbe9..53dfa9e5f6d5 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigParserDefinition.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigParserDefinition.java @@ -23,27 +23,23 @@ public final class LombokConfigParserDefinition implements ParserDefinition { private static final IFileElementType FILE = new IFileElementType(LombokConfigLanguage.INSTANCE); - @NotNull @Override - public Lexer createLexer(Project project) { + public @NotNull Lexer createLexer(Project project) { return new LombokConfigLexerAdapter(); } @Override - @NotNull - public TokenSet getCommentTokens() { + public @NotNull TokenSet getCommentTokens() { return LombokConfigParserTokenSets.COMMENTS; } @Override - @NotNull - public TokenSet getStringLiteralElements() { + public @NotNull TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } @Override - @NotNull - public PsiParser createParser(final Project project) { + public @NotNull PsiParser createParser(final Project project) { return new LombokConfigParser(); } @@ -58,8 +54,7 @@ public final class LombokConfigParserDefinition implements ParserDefinition { } @Override - @NotNull - public PsiElement createElement(ASTNode node) { + public @NotNull PsiElement createElement(ASTNode node) { return LombokConfigTypes.Factory.createElement(node); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighter.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighter.java index 62889243adb5..a34d9ee890dd 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighter.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighter.java @@ -27,9 +27,8 @@ public class LombokConfigSyntaxHighlighter extends SyntaxHighlighterBase { private static final TextAttributesKey[] CLEAR_KEYS = new TextAttributesKey[]{CLEAR}; private static final TextAttributesKey[] EMPTY_KEYS = TextAttributesKey.EMPTY_ARRAY; - @NotNull @Override - public Lexer getHighlightingLexer() { + public @NotNull Lexer getHighlightingLexer() { return new LombokConfigLexerAdapter(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighterFactory.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighterFactory.java index 52974782d50c..0c3a384c02e3 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighterFactory.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/LombokConfigSyntaxHighlighterFactory.java @@ -7,9 +7,8 @@ import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; public final class LombokConfigSyntaxHighlighterFactory extends SyntaxHighlighterFactory { - @NotNull @Override - public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { + public @NotNull SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { return new LombokConfigSyntaxHighlighter(); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigFile.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigFile.java index 79b301060171..e9382b99c41b 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigFile.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigFile.java @@ -14,9 +14,8 @@ public class LombokConfigFile extends PsiFileBase { super(viewProvider, LombokConfigLanguage.INSTANCE); } - @NotNull @Override - public FileType getFileType() { + public @NotNull FileType getFileType() { return LombokConfigFileType.INSTANCE; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigPsiUtil.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigPsiUtil.java index 264841562fd3..46e10774ec47 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigPsiUtil.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/language/psi/LombokConfigPsiUtil.java @@ -27,8 +27,7 @@ public final class LombokConfigPsiUtil { return StringUtil.trim(getNodeText(element.getNode(), LombokConfigTypes.SIGN)); } - @Nullable - private static String getNodeText(@NotNull ASTNode node, @NotNull IElementType type) { + private static @Nullable String getNodeText(@NotNull ASTNode node, @NotNull IElementType type) { final ASTNode valueNode = node.findChildByType(type); if (valueNode != null) { return valueNode.getText(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/ConfigDiscovery.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/ConfigDiscovery.java index 74e68bf51d0e..ad328b49f820 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/ConfigDiscovery.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/ConfigDiscovery.java @@ -20,8 +20,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; public class ConfigDiscovery { - @NotNull - public static ConfigDiscovery getInstance() { + public static @NotNull ConfigDiscovery getInstance() { return ApplicationManager.getApplication().getService(ConfigDiscovery.class); } @@ -46,8 +45,7 @@ public class ConfigDiscovery { return getConfigProperty(configKey, psiClass); } - @NotNull - public String getStringLombokConfigProperty(@NotNull ConfigKey configKey, @NotNull PsiClass psiClass) { + public @NotNull String getStringLombokConfigProperty(@NotNull ConfigKey configKey, @NotNull PsiClass psiClass) { Collection result = getConfigProperty(configKey, psiClass); if (!result.isEmpty()) { return result.iterator().next(); @@ -60,8 +58,7 @@ public class ConfigDiscovery { return Boolean.parseBoolean(configProperty); } - @NotNull - private Collection getConfigProperty(@NotNull ConfigKey configKey, @NotNull PsiClass psiClass) { + private @NotNull Collection getConfigProperty(@NotNull ConfigKey configKey, @NotNull PsiClass psiClass) { @Nullable PsiFile psiFile = calculatePsiFile(psiClass); if (psiFile != null) { return discoverPropertyWithCache(configKey, psiFile); @@ -69,8 +66,7 @@ public class ConfigDiscovery { return Collections.singletonList(configKey.getConfigDefaultValue()); } - @Nullable - private static PsiFile calculatePsiFile(@NotNull PsiClass psiClass) { + private static @Nullable PsiFile calculatePsiFile(@NotNull PsiClass psiClass) { PsiFile psiFile = psiClass.getContainingFile(); if (psiFile != null) { psiFile = psiFile.getOriginalFile(); @@ -78,9 +74,8 @@ public class ConfigDiscovery { return psiFile; } - @NotNull - protected Collection discoverPropertyWithCache(@NotNull ConfigKey configKey, - @NotNull PsiFile psiFile) { + protected @NotNull Collection discoverPropertyWithCache(@NotNull ConfigKey configKey, + @NotNull PsiFile psiFile) { return CachedValuesManager.getCachedValue(psiFile, () -> { Map> result = ConcurrentFactoryMap.createMap(configKeyInner -> discoverProperty(configKeyInner, psiFile)); @@ -88,16 +83,14 @@ public class ConfigDiscovery { }).get(configKey); } - @NotNull - protected Collection discoverProperty(@NotNull ConfigKey configKey, @NotNull PsiFile psiFile) { + protected @NotNull Collection discoverProperty(@NotNull ConfigKey configKey, @NotNull PsiFile psiFile) { if (configKey.isConfigScalarValue()) { return discoverScalarProperty(configKey, psiFile); } return discoverCollectionProperty(configKey, psiFile); } - @NotNull - private Collection discoverScalarProperty(@NotNull ConfigKey configKey, @NotNull PsiFile psiFile) { + private @NotNull Collection discoverScalarProperty(@NotNull ConfigKey configKey, @NotNull PsiFile psiFile) { @Nullable VirtualFile currentFile = psiFile.getVirtualFile(); while (currentFile != null) { ConfigValue configValue = readProperty(configKey, psiFile.getProject(), currentFile); @@ -123,8 +116,7 @@ public class ConfigDiscovery { return FileBasedIndex.getInstance(); } - @Nullable - private ConfigValue readProperty(@NotNull ConfigKey configKey, @NotNull Project project, @NotNull VirtualFile directory) { + private @Nullable ConfigValue readProperty(@NotNull ConfigKey configKey, @NotNull Project project, @NotNull VirtualFile directory) { if (DumbService.getInstance(project).isAlternativeResolveEnabled()) { return LombokConfigIndex.readPropertyWithAlternativeResolver(configKey, project, directory); } @@ -136,8 +128,7 @@ public class ConfigDiscovery { return null; } - @NotNull - private Collection discoverCollectionProperty(@NotNull ConfigKey configKey, @NotNull PsiFile file) { + private @NotNull Collection discoverCollectionProperty(@NotNull ConfigKey configKey, @NotNull PsiFile file) { List properties = new ArrayList<>(); final Project project = file.getProject(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/LombokConfigIndex.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/LombokConfigIndex.java index c4a595a7f35f..8faa3e6d2fef 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/LombokConfigIndex.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/lombokconfig/LombokConfigIndex.java @@ -34,24 +34,19 @@ import java.util.HashMap; import java.util.Map; public final class LombokConfigIndex extends FileBasedIndexExtension { - @NotNull - private static final String LOMBOK_CONFIG_FILE_NAME = "lombok.config"; - @NonNls - public static final ID NAME = ID.create("LombokConfigIndex"); + private static final @NotNull String LOMBOK_CONFIG_FILE_NAME = "lombok.config"; + public static final @NonNls ID NAME = ID.create("LombokConfigIndex"); - @NotNull @Override - public ID getName() { + public @NotNull ID getName() { return NAME; } - @NotNull @Override - public DataIndexer getIndexer() { + public @NotNull DataIndexer getIndexer() { return new DataIndexer<>() { - @NotNull @Override - public Map map(@NotNull FileContent inputData) { + public @NotNull Map map(@NotNull FileContent inputData) { final VirtualFile directoryFile = inputData.getFile().getParent(); if (null != directoryFile) { final String canonicalPath = PathUtil.toSystemIndependentName(directoryFile.getCanonicalPath()); @@ -65,8 +60,7 @@ public final class LombokConfigIndex extends FileBasedIndexExtension createConfigMapResult(@Nullable PsiFile psiFile) { + private static @Unmodifiable @NotNull Map createConfigMapResult(@Nullable PsiFile psiFile) { if (!(psiFile instanceof LombokConfigFile)) { return Map.of(); } @@ -111,15 +105,13 @@ public final class LombokConfigIndex extends FileBasedIndexExtension getKeyDescriptor() { + public @NotNull KeyDescriptor getKeyDescriptor() { return new EnumDataDescriptor<>(ConfigKey.class); } - @NotNull @Override - public DataExternalizer getValueExternalizer() { + public @NotNull DataExternalizer getValueExternalizer() { return new DataExternalizer<>() { @Override public void save(@NotNull DataOutput out, ConfigValue configValue) throws IOException { @@ -139,9 +131,8 @@ public final class LombokConfigIndex extends FileBasedIndexExtension getSupportedClass() { + public final @NotNull Class getSupportedClass() { return supportedClass; } - @NotNull - public abstract Collection collectProcessedAnnotations(@NotNull PsiClass psiClass); + public abstract @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass); protected boolean supportAnnotationVariant(@NotNull PsiAnnotation psiAnnotation) { return true; } - @Unmodifiable - protected @NotNull Collection filterToleratedElements(@NotNull @Unmodifiable Collection definedMethods) { + protected @Unmodifiable @NotNull Collection filterToleratedElements(@NotNull @Unmodifiable Collection definedMethods) { return ContainerUtil.filter(definedMethods, definedMethod -> !PsiAnnotationSearchUtil.isAnnotatedWith(definedMethod, LombokClassNames.TOLERATE)); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/CleanupProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/CleanupProcessor.java index 9c7d6e105317..5a6724d5b3df 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/CleanupProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/CleanupProcessor.java @@ -23,15 +23,13 @@ public final class CleanupProcessor extends AbstractProcessor { super(PsiElement.class, LombokClassNames.CLEANUP); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { return Collections.emptyList(); } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { // TODO warning: "You're assigning an auto-cleanup variable to something else. This is a bad idea." final ProblemValidationSink problemNewBuilder = new ProblemValidationSink(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/JacksonizedProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/JacksonizedProcessor.java index 622b126adb5b..e2d1dd3df6d2 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/JacksonizedProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/JacksonizedProcessor.java @@ -23,15 +23,13 @@ public final class JacksonizedProcessor extends AbstractProcessor { super(PsiElement.class, LombokClassNames.JACKSONIZED); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { return Collections.emptyList(); } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { final ProblemValidationSink validationSink = new ProblemValidationSink(); final PsiModifierListOwner psiModifierListOwner; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/LombokProcessorManager.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/LombokProcessorManager.java index a838276663ef..5f94cadede24 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/LombokProcessorManager.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/LombokProcessorManager.java @@ -91,8 +91,7 @@ public final class LombokProcessorManager { private final MultiMap ourSupportedShortNames = createSupportedShortNames(); - @NotNull - private MultiMap createSupportedShortNames() { + private @NotNull MultiMap createSupportedShortNames() { MultiMap map = new MultiMap<>(); for (Processor processor : getAllProcessors()) { for (String annotationClass : processor.getSupportedAnnotationClasses()) { @@ -282,8 +281,7 @@ public final class LombokProcessorManager { return ourSupportedShortNames; } - @NotNull - private Collection getAllProcessors() { + private @NotNull Collection getAllProcessors() { return Arrays.asList( myAllArgsConstructorProcessor, myNoArgsConstructorProcessor, diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/Processor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/Processor.java index 225d0b11a5a2..b74baf5b325d 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/Processor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/Processor.java @@ -34,13 +34,11 @@ public interface Processor { @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation); - @NotNull - default List process(@NotNull PsiClass psiClass) { + default @NotNull List process(@NotNull PsiClass psiClass) { return process(psiClass, null); } - @NotNull - default List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + default @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { return Collections.emptyList(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/SynchronizedProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/SynchronizedProcessor.java index 8ed2418d3a28..677d9d231f6a 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/SynchronizedProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/SynchronizedProcessor.java @@ -26,15 +26,13 @@ public final class SynchronizedProcessor extends AbstractProcessor { super(PsiElement.class, LombokClassNames.SYNCHRONIZED); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { return Collections.emptyList(); } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { final ProblemValidationSink problemBuilder = new ProblemValidationSink(); PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiAnnotation, PsiMethod.class); @@ -62,7 +60,7 @@ public final class SynchronizedProcessor extends AbstractProcessor { private static void validateReferencedField(@NotNull ProblemSink problemNewBuilder, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiMethod psiMethod, @NotNull PsiClass containingClass) { - @NlsSafe final String lockFieldName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "value", ""); + final @NlsSafe String lockFieldName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "value", ""); if (StringUtil.isNotEmpty(lockFieldName)) { final boolean isStatic = psiMethod.hasModifierProperty(PsiModifier.STATIC); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java index 88b606dc3547..4a3c3e019cbf 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java @@ -109,8 +109,7 @@ public class ValProcessor extends AbstractProcessor { return LombokClassNames.VAR.equals(fullQualifiedName) || LombokClassNames.EXPERIMENTAL_VAR.equals(fullQualifiedName); } - @Nullable - private static String resolveQualifiedName(@NotNull PsiTypeElement typeElement) { + private static @Nullable String resolveQualifiedName(@NotNull PsiTypeElement typeElement) { PsiJavaCodeReferenceElement reference = typeElement.getInnermostComponentReferenceElement(); if (reference == null) { return null; @@ -119,19 +118,17 @@ public class ValProcessor extends AbstractProcessor { return reference.getQualifiedName(); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { return Collections.emptyList(); } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { return Collections.emptyList(); } - public void verifyVariable(@NotNull final PsiLocalVariable psiLocalVariable, @NotNull final ProblemsHolder holder) { + public void verifyVariable(final @NotNull PsiLocalVariable psiLocalVariable, final @NotNull ProblemsHolder holder) { final PsiTypeElement typeElement = psiLocalVariable.getTypeElement(); final String typeElementText = typeElement.getText(); boolean isVal = isPossibleVal(typeElementText) && isVal(resolveQualifiedName(typeElement)); @@ -156,7 +153,7 @@ public class ValProcessor extends AbstractProcessor { } } - public void verifyParameter(@NotNull final PsiParameter psiParameter, @NotNull final ProblemsHolder holder) { + public void verifyParameter(final @NotNull PsiParameter psiParameter, final @NotNull ProblemsHolder holder) { final PsiTypeElement typeElement = psiParameter.getTypeElement(); final String typeElementText = null != typeElement ? typeElement.getText() : null; boolean isVal = isPossibleVal(typeElementText) && isVal(resolveQualifiedName(typeElement)); @@ -180,8 +177,7 @@ public class ValProcessor extends AbstractProcessor { (parent instanceof PsiParameter && isValOrVarForEach((PsiParameter) parent)); } - @Nullable - public static PsiType inferType(PsiTypeElement typeElement) { + public static @Nullable PsiType inferType(PsiTypeElement typeElement) { PsiType psiType = null; if (canInferType(typeElement)) { diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/AbstractClassProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/AbstractClassProcessor.java index 6480bdbcbdf9..656db03cc484 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/AbstractClassProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/AbstractClassProcessor.java @@ -41,9 +41,8 @@ public abstract class AbstractClassProcessor extends AbstractProcessor implement super(supportedClass, supportedAnnotationClass, equivalentAnnotationClass); } - @NotNull @Override - public List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { List result = Collections.emptyList(); PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiClass, getSupportedAnnotationClasses()); if (null != psiAnnotation @@ -74,9 +73,8 @@ public abstract class AbstractClassProcessor extends AbstractProcessor implement return Collections.emptyList(); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { Collection result = new ArrayList<>(); PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiClass, getSupportedAnnotationClasses()); if (null != psiAnnotation) { @@ -101,9 +99,8 @@ public abstract class AbstractClassProcessor extends AbstractProcessor implement } } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { Collection result = Collections.emptyList(); // check first for fields, methods and filter it out, because PsiClass is parent of all annotations and will match other parents too PsiElement psiElement = PsiTreeUtil.getParentOfType(psiAnnotation, PsiField.class, PsiRecordComponent.class, PsiMethod.class, PsiClass.class); @@ -124,8 +121,7 @@ public abstract class AbstractClassProcessor extends AbstractProcessor implement return Optional.empty(); } - @Nullable - protected PsiAnnotation getSupportedAnnotation(@NotNull PsiClass psiParentClass) { + protected @Nullable PsiAnnotation getSupportedAnnotation(@NotNull PsiClass psiParentClass) { return PsiAnnotationSearchUtil.findAnnotation(psiParentClass, getSupportedAnnotationClasses()); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/EqualsAndHashCodeProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/EqualsAndHashCodeProcessor.java index 0a769b4c8b1f..3bf4063fe0dd 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/EqualsAndHashCodeProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/EqualsAndHashCodeProcessor.java @@ -176,10 +176,9 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor { return !isFinal; } - @NotNull - private PsiMethod createEqualsMethod(@NotNull PsiClass psiClass, - @NotNull PsiAnnotation psiAnnotation, - boolean hasCanEqualMethod) { + private @NotNull PsiMethod createEqualsMethod(@NotNull PsiClass psiClass, + @NotNull PsiAnnotation psiAnnotation, + boolean hasCanEqualMethod) { final PsiManager psiManager = psiClass.getManager(); final LombokLightMethodBuilder methodBuilder = new LombokLightMethodBuilder(psiManager, EQUALS_METHOD_NAME) @@ -227,8 +226,7 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor { }); } - @NotNull - private static PsiMethod createCanEqualMethod(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + private static @NotNull PsiMethod createCanEqualMethod(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { final PsiManager psiManager = psiClass.getManager(); final String blockText = String.format("return other instanceof %s;", PsiTypesUtil.getClassType(psiClass).getCanonicalText()); @@ -323,10 +321,9 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor { private static final int PRIME_FOR_FALSE = 97; private static final int PRIME_FOR_NULL = 43; - @NotNull - private String createHashcodeBlockString(@NotNull PsiClass psiClass, - @NotNull PsiAnnotation psiAnnotation, - Collection memberInfos) { + private @NotNull String createHashcodeBlockString(@NotNull PsiClass psiClass, + @NotNull PsiAnnotation psiAnnotation, + Collection memberInfos) { final boolean callSuper = readCallSuperAnnotationOrConfigProperty(psiAnnotation, psiClass, ConfigKey.EQUALSANDHASHCODE_CALL_SUPER); final boolean doNotUseGetters = readAnnotationOrConfigProperty(psiAnnotation, psiClass, "doNotUseGetters", ConfigKey.EQUALSANDHASHCODE_DO_NOT_USE_GETTERS); @@ -390,9 +387,8 @@ public final class EqualsAndHashCodeProcessor extends AbstractClassProcessor { return builder.toString(); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { final Collection result = super.collectProcessedAnnotations(psiClass); addFieldsAnnotation(result, psiClass, EQUALS_AND_HASHCODE_INCLUDE, EQUALS_AND_HASHCODE_EXCLUDE); return result; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/GetterProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/GetterProcessor.java index f0657459ad19..61fbd9111555 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/GetterProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/GetterProcessor.java @@ -93,8 +93,7 @@ public final class GetterProcessor extends AbstractClassProcessor { } } - @NotNull - public Collection createFieldGetters(@NotNull PsiClass psiClass, @NotNull String methodModifier, @Nullable String nameHint) { + public @NotNull Collection createFieldGetters(@NotNull PsiClass psiClass, @NotNull String methodModifier, @Nullable String nameHint) { Collection result = new ArrayList<>(); final Collection getterFields = filterGetterFields(psiClass); @@ -104,8 +103,7 @@ public final class GetterProcessor extends AbstractClassProcessor { return result; } - @NotNull - private Collection filterGetterFields(@NotNull PsiClass psiClass) { + private @NotNull Collection filterGetterFields(@NotNull PsiClass psiClass) { final Collection getterFields = new ArrayList<>(); Collection classMethods = filterToleratedElements(PsiClassUtil.collectClassMethodsIntern(psiClass)); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/SetterProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/SetterProcessor.java index 7e3d0c52e1a4..164bb197406a 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/SetterProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/SetterProcessor.java @@ -104,8 +104,7 @@ public final class SetterProcessor extends AbstractClassProcessor { return result; } - @NotNull - private Collection filterSetterFields(@NotNull PsiClass psiClass) { + private @NotNull Collection filterSetterFields(@NotNull PsiClass psiClass) { final Collection classMethods = filterToleratedElements(PsiClassUtil.collectClassMethodsIntern(psiClass)); final SetterFieldProcessor fieldProcessor = getSetterFieldProcessor(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ToStringProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ToStringProcessor.java index 411b6cd5c2b6..269569971572 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ToStringProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ToStringProcessor.java @@ -111,9 +111,8 @@ public final class ToStringProcessor extends AbstractClassProcessor { return Collections.singletonList(stringMethod); } - @NotNull - public PsiMethod createToStringMethod(@NotNull PsiClass psiClass, @NotNull Collection memberInfos, - @NotNull PsiAnnotation psiAnnotation, boolean forceCallSuper) { + public @NotNull PsiMethod createToStringMethod(@NotNull PsiClass psiClass, @NotNull Collection memberInfos, + @NotNull PsiAnnotation psiAnnotation, boolean forceCallSuper) { final PsiManager psiManager = psiClass.getManager(); final String paramString = createParamString(psiClass, memberInfos, psiAnnotation, forceCallSuper); @@ -195,9 +194,8 @@ public final class ToStringProcessor extends AbstractClassProcessor { return paramString.toString(); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { final Collection result = super.collectProcessedAnnotations(psiClass); addFieldsAnnotation(result, psiClass, TO_STRING_INCLUDE, TO_STRING_EXCLUDE); return result; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/UtilityClassProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/UtilityClassProcessor.java index 8352c01750e7..6ca8f08d2b2e 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/UtilityClassProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/UtilityClassProcessor.java @@ -90,7 +90,7 @@ public final class UtilityClassProcessor extends AbstractClassProcessor { } @Override - protected void generatePsiElements(@NotNull final PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, @NotNull List target, + protected void generatePsiElements(final @NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, @NotNull List target, @Nullable String nameHint) { LombokLightMethodBuilder constructorBuilder = new LombokLightMethodBuilder(psiClass.getManager(), psiClass.getName()) diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ValueProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ValueProcessor.java index 6562a97c359a..d22f29d739a3 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ValueProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/ValueProcessor.java @@ -135,9 +135,8 @@ public final class ValueProcessor extends AbstractClassProcessor { } } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { final Collection result = super.collectProcessedAnnotations(psiClass); addClassAnnotation(result, psiClass, LombokClassNames.NON_FINAL, LombokClassNames.PACKAGE_PRIVATE); addFieldsAnnotation(result, psiClass, LombokClassNames.NON_FINAL, LombokClassNames.PACKAGE_PRIVATE); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/WitherProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/WitherProcessor.java index 54d0a2868f31..00ad5ac37a9a 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/WitherProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/WitherProcessor.java @@ -58,8 +58,7 @@ public final class WitherProcessor extends AbstractClassProcessor { return result; } - @NotNull - private static Collection getPossibleWithElements(@NotNull PsiClass psiClass) { + private static @NotNull Collection getPossibleWithElements(@NotNull PsiClass psiClass) { if (psiClass.isRecord()) { return List.of(psiClass.getRecordComponents()); } @@ -102,10 +101,9 @@ public final class WitherProcessor extends AbstractClassProcessor { } } - @NotNull - private static Collection createFieldWithers(@NotNull PsiClass psiClass, - @NotNull String methodModifier, - @NotNull AccessorsInfo accessors) { + private static @NotNull Collection createFieldWithers(@NotNull PsiClass psiClass, + @NotNull String methodModifier, + @NotNull AccessorsInfo accessors) { Collection result = new ArrayList<>(); final Collection witherFields = getWitherFields(psiClass); @@ -120,8 +118,7 @@ public final class WitherProcessor extends AbstractClassProcessor { return result; } - @NotNull - private static Collection getWitherFields(@NotNull PsiClass psiClass) { + private static @NotNull Collection getWitherFields(@NotNull PsiClass psiClass) { Collection witherFields = new ArrayList<>(); for (PsiField psiField : psiClass.getFields()) { diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractBuilderPreDefinedInnerClassProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractBuilderPreDefinedInnerClassProcessor.java index 4a2d70108267..cebfd8ef23de 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractBuilderPreDefinedInnerClassProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractBuilderPreDefinedInnerClassProcessor.java @@ -23,9 +23,8 @@ public abstract class AbstractBuilderPreDefinedInnerClassProcessor extends Abstr super(supportedClass, supportedAnnotationClass); } - @NotNull @Override - public List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { final Optional parentClass = getSupportedParentClass(psiClass); final Optional builderAnnotation = parentClass.map(this::getSupportedAnnotation); if (builderAnnotation.isPresent()) { @@ -73,9 +72,8 @@ public abstract class AbstractBuilderPreDefinedInnerClassProcessor extends Abstr protected abstract Collection generatePsiElements(@NotNull PsiClass psiParentClass, @Nullable PsiMethod psiParentMethod, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiBuilderClass); - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { //do nothing return Collections.emptySet(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractSuperBuilderPreDefinedInnerClassProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractSuperBuilderPreDefinedInnerClassProcessor.java index ae7089be81e0..5aa471a28585 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractSuperBuilderPreDefinedInnerClassProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/AbstractSuperBuilderPreDefinedInnerClassProcessor.java @@ -24,9 +24,8 @@ public abstract class AbstractSuperBuilderPreDefinedInnerClassProcessor extends return new SuperBuilderHandler(); } - @NotNull @Override - public List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { final Optional parentClass = getSupportedParentClass(psiClass); final Optional psiAnnotation = parentClass.map(this::getSupportedAnnotation); if (psiAnnotation.isPresent()) { @@ -65,9 +64,8 @@ public abstract class AbstractSuperBuilderPreDefinedInnerClassProcessor extends protected abstract Collection generatePsiElementsOfImplBuilderClass(@NotNull PsiClass psiParentClass, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiBuilderClass); - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { //do nothing return Collections.emptySet(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/BuilderProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/BuilderProcessor.java index 7fa9cb69cc12..29d68e2d10c5 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/BuilderProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/BuilderProcessor.java @@ -59,9 +59,8 @@ public final class BuilderProcessor extends AbstractClassProcessor { return List.of(builderMethodName, BuilderHandler.TO_BUILDER_METHOD_NAME, constructorName); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { final Collection result = super.collectProcessedAnnotations(psiClass); addJacksonizedAnnotation(psiClass, result); addFieldsAnnotation(result, psiClass, SINGULAR_CLASS, BUILDER_DEFAULT_CLASS); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/SuperBuilderProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/SuperBuilderProcessor.java index a41ddc2a4ef4..d1a1af0d6778 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/SuperBuilderProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/builder/SuperBuilderProcessor.java @@ -49,9 +49,8 @@ public final class SuperBuilderProcessor extends AbstractClassProcessor { return List.of(builderMethodName, BuilderHandler.TO_BUILDER_METHOD_NAME, constructorName); } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { final Collection result = super.collectProcessedAnnotations(psiClass); addJacksonizedAnnotation(psiClass, result); addFieldsAnnotation(result, psiClass, BuilderProcessor.SINGULAR_CLASS, BuilderProcessor.BUILDER_DEFAULT_CLASS); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AbstractConstructorClassProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AbstractConstructorClassProcessor.java index f8e8cdbb6ee2..4c6343b88d9d 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AbstractConstructorClassProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AbstractConstructorClassProcessor.java @@ -160,15 +160,13 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return result; } - @NotNull - public String getConstructorName(@NotNull PsiClass psiClass) { + public @NotNull String getConstructorName(@NotNull PsiClass psiClass) { return StringUtil.notNullize(psiClass.getName()); } - @Nullable - private static PsiMethod findExistedMethod(final Collection definedMethods, - final String methodName, - final List paramTypes) { + private static @Nullable PsiMethod findExistedMethod(final Collection definedMethods, + final String methodName, + final List paramTypes) { for (PsiMethod method : definedMethods) { if (PsiElementUtil.methodMatches(method, null, null, methodName, paramTypes)) { return method; @@ -177,8 +175,7 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return null; } - @NotNull - protected static Collection getAllNotInitializedAndNotStaticFields(@NotNull PsiClass psiClass) { + protected static @NotNull Collection getAllNotInitializedAndNotStaticFields(@NotNull PsiClass psiClass) { Collection allNotInitializedNotStaticFields = new ArrayList<>(); final boolean classAnnotatedWithValue = PsiAnnotationSearchUtil.isAnnotatedWith(psiClass, LombokClassNames.VALUE); Collection fields = psiClass.isRecord() ? RecordAugmentProvider.getFieldAugments(psiClass) @@ -208,13 +205,11 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return addField; } - @NotNull - public static Collection getAllFields(@NotNull PsiClass psiClass) { + public static @NotNull Collection getAllFields(@NotNull PsiClass psiClass) { return getAllNotInitializedAndNotStaticFields(psiClass); } - @NotNull - public Collection getRequiredFields(@NotNull PsiClass psiClass) { + public @NotNull Collection getRequiredFields(@NotNull PsiClass psiClass) { return getRequiredFields(psiClass, false); } @@ -251,12 +246,11 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return isFinal; } - @NotNull - protected Collection createConstructorMethod(@NotNull PsiClass psiClass, - @PsiModifier.ModifierConstant @NotNull String methodModifier, - @NotNull PsiAnnotation psiAnnotation, - boolean useJavaDefaults, - @NotNull Collection params) { + protected @NotNull Collection createConstructorMethod(@NotNull PsiClass psiClass, + @PsiModifier.ModifierConstant @NotNull String methodModifier, + @NotNull PsiAnnotation psiAnnotation, + boolean useJavaDefaults, + @NotNull Collection params) { final String staticName = getStaticConstructorName(psiAnnotation); return createConstructorMethod(psiClass, methodModifier, psiAnnotation, useJavaDefaults, params, staticName, false); @@ -270,12 +264,11 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return !StringUtil.isEmptyOrSpaces(staticName); } - @NotNull - protected Collection createConstructorMethod(@NotNull PsiClass psiClass, - @PsiModifier.ModifierConstant @NotNull String methodModifier, - @NotNull PsiAnnotation psiAnnotation, boolean useJavaDefaults, - @NotNull Collection params, @Nullable String staticName, - boolean skipConstructorIfAnyConstructorExists) { + protected @NotNull Collection createConstructorMethod(@NotNull PsiClass psiClass, + @PsiModifier.ModifierConstant @NotNull String methodModifier, + @NotNull PsiAnnotation psiAnnotation, boolean useJavaDefaults, + @NotNull Collection params, @Nullable String staticName, + boolean skipConstructorIfAnyConstructorExists) { List methods = new ArrayList<>(); boolean hasStaticConstructor = !validateIsStaticConstructorNotDefined(psiClass, staticName, params, new ProblemProcessingSink()); @@ -422,10 +415,9 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return methodBuilder; } - @NotNull - private static LightTypeParameterBuilder createTypeParameter(LombokLightMethodBuilder method, - int index, - PsiTypeParameter psiClassTypeParameter) { + private static @NotNull LightTypeParameterBuilder createTypeParameter(LombokLightMethodBuilder method, + int index, + PsiTypeParameter psiClassTypeParameter) { final String nameOfTypeParameter = StringUtil.notNullize(psiClassTypeParameter.getName()); final LightTypeParameterBuilder result = new LightTypeParameterBuilder(nameOfTypeParameter, method, index); @@ -436,10 +428,9 @@ public abstract class AbstractConstructorClassProcessor extends AbstractClassPro return result; } - @NotNull - private static String createStaticCodeBlockText(@NotNull PsiType psiType, - boolean useJavaDefaults, - @NotNull final PsiParameterList parameterList) { + private static @NotNull String createStaticCodeBlockText(@NotNull PsiType psiType, + boolean useJavaDefaults, + final @NotNull PsiParameterList parameterList) { final String psiClassName = psiType.getPresentableText(); final String paramsText = useJavaDefaults ? "" : joinParameters(parameterList); return String.format("return new %s(%s);", psiClassName, paramsText); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AllArgsConstructorProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AllArgsConstructorProcessor.java index 840b04fd5d82..e24ee3a05b99 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AllArgsConstructorProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/AllArgsConstructorProcessor.java @@ -6,7 +6,6 @@ import de.plushnikov.intellij.plugin.problem.ProblemSink; import de.plushnikov.intellij.plugin.processor.LombokPsiElementUsage; import de.plushnikov.intellij.plugin.util.LombokProcessorUtil; import de.plushnikov.intellij.plugin.util.PsiAnnotationSearchUtil; -import de.plushnikov.intellij.plugin.util.PsiClassUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,8 +33,7 @@ public final class AllArgsConstructorProcessor extends AbstractConstructorClassP return result; } - @NotNull - public Collection createAllArgsConstructor(@NotNull PsiClass psiClass, @NotNull String methodVisibility, @NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection createAllArgsConstructor(@NotNull PsiClass psiClass, @NotNull String methodVisibility, @NotNull PsiAnnotation psiAnnotation) { final Collection allNotInitializedNotStaticFields = getAllNotInitializedAndNotStaticFields(psiClass); return createConstructorMethod(psiClass, methodVisibility, psiAnnotation, false, allNotInitializedNotStaticFields); } @@ -50,14 +48,12 @@ public final class AllArgsConstructorProcessor extends AbstractConstructorClassP } } - @NotNull - private Collection createAllArgsConstructor(PsiClass psiClass, String methodVisibility, PsiAnnotation psiAnnotation, String staticName) { + private @NotNull Collection createAllArgsConstructor(PsiClass psiClass, String methodVisibility, PsiAnnotation psiAnnotation, String staticName) { final Collection allNotInitializedNotStaticFields = getAllFields(psiClass); return createAllArgsConstructor(psiClass, methodVisibility, psiAnnotation, staticName, allNotInitializedNotStaticFields, false); } - @NotNull - public Collection createAllArgsConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String methodModifier, @NotNull PsiAnnotation psiAnnotation, String staticName, Collection allNotInitializedNotStaticFields, boolean skipConstructorIfAnyConstructorExists) { + public @NotNull Collection createAllArgsConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String methodModifier, @NotNull PsiAnnotation psiAnnotation, String staticName, Collection allNotInitializedNotStaticFields, boolean skipConstructorIfAnyConstructorExists) { return createConstructorMethod(psiClass, methodModifier, psiAnnotation, false, allNotInitializedNotStaticFields, staticName, skipConstructorIfAnyConstructorExists); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/NoArgsConstructorProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/NoArgsConstructorProcessor.java index 032b2b0c49fb..88dd4004817d 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/NoArgsConstructorProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/NoArgsConstructorProcessor.java @@ -8,7 +8,6 @@ import de.plushnikov.intellij.plugin.quickfix.PsiQuickFixFactory; import de.plushnikov.intellij.plugin.util.LombokProcessorUtil; import de.plushnikov.intellij.plugin.util.PsiAnnotationSearchUtil; import de.plushnikov.intellij.plugin.util.PsiAnnotationUtil; -import de.plushnikov.intellij.plugin.util.PsiClassUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -46,19 +45,17 @@ public final class NoArgsConstructorProcessor extends AbstractConstructorClassPr return result; } - @NotNull - public Collection createNoArgsConstructor(@NotNull PsiClass psiClass, - @NotNull String methodVisibility, - @NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection createNoArgsConstructor(@NotNull PsiClass psiClass, + @NotNull String methodVisibility, + @NotNull PsiAnnotation psiAnnotation) { final boolean forceConstructorWithJavaDefaults = isForceConstructor(psiAnnotation); return createNoArgsConstructor(psiClass, methodVisibility, psiAnnotation, forceConstructorWithJavaDefaults); } - @NotNull - public Collection createNoArgsConstructor(@NotNull PsiClass psiClass, - @NotNull String methodVisibility, - @NotNull PsiAnnotation psiAnnotation, - boolean withJavaDefaults) { + public @NotNull Collection createNoArgsConstructor(@NotNull PsiClass psiClass, + @NotNull String methodVisibility, + @NotNull PsiAnnotation psiAnnotation, + boolean withJavaDefaults) { final Collection params = getConstructorFields(psiClass, withJavaDefaults); return createConstructorMethod(psiClass, methodVisibility, psiAnnotation, withJavaDefaults, params); } @@ -92,8 +89,7 @@ public final class NoArgsConstructorProcessor extends AbstractConstructorClassPr return LombokPsiElementUsage.NONE; } - @NotNull - private Collection getConstructorFields(PsiClass containingClass, boolean forceConstructorWithJavaDefaults) { + private @NotNull Collection getConstructorFields(PsiClass containingClass, boolean forceConstructorWithJavaDefaults) { Collection params; if (forceConstructorWithJavaDefaults) { params = getRequiredFields(containingClass); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/RequiredArgsConstructorProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/RequiredArgsConstructorProcessor.java index a01c30d50fb5..18acc75acb80 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/RequiredArgsConstructorProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/constructor/RequiredArgsConstructorProcessor.java @@ -6,7 +6,6 @@ import de.plushnikov.intellij.plugin.problem.ProblemSink; import de.plushnikov.intellij.plugin.processor.LombokPsiElementUsage; import de.plushnikov.intellij.plugin.util.LombokProcessorUtil; import de.plushnikov.intellij.plugin.util.PsiAnnotationSearchUtil; -import de.plushnikov.intellij.plugin.util.PsiClassUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,8 +43,7 @@ public final class RequiredArgsConstructorProcessor extends AbstractConstructorC } } - @NotNull - public Collection createRequiredArgsConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String methodModifier, @NotNull PsiAnnotation psiAnnotation, @Nullable String staticName, boolean skipConstructorIfAnyConstructorExists) { + public @NotNull Collection createRequiredArgsConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String methodModifier, @NotNull PsiAnnotation psiAnnotation, @Nullable String staticName, boolean skipConstructorIfAnyConstructorExists) { final Collection allReqFields = getRequiredFields(psiClass); return createConstructorMethod(psiClass, methodModifier, psiAnnotation, false, allReqFields, staticName, skipConstructorIfAnyConstructorExists); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/AbstractFieldNameConstantsProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/AbstractFieldNameConstantsProcessor.java index b9f188892726..28f50e052034 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/AbstractFieldNameConstantsProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/AbstractFieldNameConstantsProcessor.java @@ -92,9 +92,8 @@ public abstract class AbstractFieldNameConstantsProcessor extends AbstractClassP return useField; } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { final Collection result = super.collectProcessedAnnotations(psiClass); addFieldsAnnotation(result, psiClass, FIELD_NAME_CONSTANTS_INCLUDE, FIELD_NAME_CONSTANTS_EXCLUDE); return result; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsOldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsOldProcessor.java index 5212bf47c84c..abd7cd373208 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsOldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsOldProcessor.java @@ -80,8 +80,7 @@ public final class FieldNameConstantsOldProcessor extends AbstractClassProcessor } } - @NotNull - private static Collection filterFields(@NotNull PsiClass psiClass) { + private static @NotNull Collection filterFields(@NotNull PsiClass psiClass) { final Collection psiFields = new ArrayList<>(); final FieldNameConstantsFieldProcessor fieldProcessor = getFieldNameConstantsFieldProcessor(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsPredefinedInnerClassFieldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsPredefinedInnerClassFieldProcessor.java index 969c0a1cfd06..a6491ed62da0 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsPredefinedInnerClassFieldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/fieldnameconstants/FieldNameConstantsPredefinedInnerClassFieldProcessor.java @@ -24,9 +24,8 @@ public final class FieldNameConstantsPredefinedInnerClassFieldProcessor extends super(PsiField.class, LombokClassNames.FIELD_NAME_CONSTANTS); } - @NotNull @Override - public List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { if (psiClass.getParent() instanceof PsiClass parentClass) { PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(parentClass, getSupportedAnnotationClasses()); if (null != psiAnnotation && supportAnnotationVariant(psiAnnotation)) { diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractLogProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractLogProcessor.java index 6d7450c52d6a..f795ae62a3f2 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractLogProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractLogProcessor.java @@ -30,8 +30,7 @@ public abstract class AbstractLogProcessor extends AbstractClassProcessor { NULL, UNKNOWN; - @NotNull - static LoggerInitializerParameter find(@NotNull String parameter) { + static @NotNull LoggerInitializerParameter find(@NotNull String parameter) { return switch (parameter) { case "TYPE" -> TYPE; case "NAME" -> NAME; @@ -51,8 +50,7 @@ public abstract class AbstractLogProcessor extends AbstractClassProcessor { return Collections.singleton(getLoggerName(psiClass)); } - @NotNull - public static String getLoggerName(@NotNull PsiClass psiClass) { + public static @NotNull String getLoggerName(@NotNull PsiClass psiClass) { return ConfigDiscovery.getInstance().getStringLombokConfigProperty(ConfigKey.LOG_FIELDNAME, psiClass); } @@ -63,20 +61,17 @@ public abstract class AbstractLogProcessor extends AbstractClassProcessor { /** * Nullable because it can be called before validation. */ - @Nullable - public abstract String getLoggerType(@NotNull PsiClass psiClass); + public abstract @Nullable String getLoggerType(@NotNull PsiClass psiClass); /** * Call only after validation. */ - @NotNull - abstract String getLoggerInitializer(@NotNull PsiClass psiClass); + abstract @NotNull String getLoggerInitializer(@NotNull PsiClass psiClass); /** * Call only after validation. */ - @NotNull - abstract List getLoggerInitializerParameters(@NotNull PsiClass psiClass, boolean topicPresent); + abstract @NotNull List getLoggerInitializerParameters(@NotNull PsiClass psiClass, boolean topicPresent); @Override protected boolean validate(@NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiClass, @NotNull ProblemSink builder) { @@ -130,8 +125,7 @@ public abstract class AbstractLogProcessor extends AbstractClassProcessor { return loggerField; } - @NotNull - private String createLoggerInitializeParameters(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + private @NotNull String createLoggerInitializeParameters(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { final StringBuilder parametersBuilder = new StringBuilder(); final String topic = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "topic", ""); final boolean topicPresent = !StringUtil.isEmptyOrSpaces(topic); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractSimpleLogProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractSimpleLogProcessor.java index dcf519adfb14..df881ced4382 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractSimpleLogProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/AbstractSimpleLogProcessor.java @@ -7,10 +7,8 @@ import java.util.Collections; import java.util.List; abstract class AbstractSimpleLogProcessor extends AbstractLogProcessor { - @NotNull - private final String loggerType; - @NotNull - private final String loggerInitializer; + private final @NotNull String loggerType; + private final @NotNull String loggerInitializer; AbstractSimpleLogProcessor( @NotNull String supportedAnnotationClass, @@ -22,22 +20,19 @@ abstract class AbstractSimpleLogProcessor extends AbstractLogProcessor { this.loggerInitializer = loggerInitializer; } - @NotNull @Override - public final String getLoggerType(@NotNull PsiClass psiClass) { + public final @NotNull String getLoggerType(@NotNull PsiClass psiClass) { return loggerType; } - @NotNull @Override - final String getLoggerInitializer(@NotNull PsiClass psiClass) { + final @NotNull String getLoggerInitializer(@NotNull PsiClass psiClass) { return loggerInitializer; } } abstract class AbstractTopicSupportingSimpleLogProcessor extends AbstractSimpleLogProcessor { - @NotNull - private final LoggerInitializerParameter defaultParameter; + private final @NotNull LoggerInitializerParameter defaultParameter; AbstractTopicSupportingSimpleLogProcessor( @NotNull String supportedAnnotationClass, @@ -49,9 +44,8 @@ abstract class AbstractTopicSupportingSimpleLogProcessor extends AbstractSimpleL this.defaultParameter = defaultParameter; } - @NotNull @Override - final List getLoggerInitializerParameters(@NotNull PsiClass psiClass, boolean topicPresent) { + final @NotNull List getLoggerInitializerParameters(@NotNull PsiClass psiClass, boolean topicPresent) { return Collections.singletonList(topicPresent ? LoggerInitializerParameter.TOPIC : defaultParameter); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogParser.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogParser.java index 6f27f5aff5ce..46289313e5d0 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogParser.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogParser.java @@ -70,8 +70,7 @@ final class CustomLogParser { throw new UnsupportedOperationException("Utility class"); } - @Nullable - static String parseLoggerType(@NotNull String customDeclaration) { + static @Nullable String parseLoggerType(@NotNull String customDeclaration) { final Matcher declarationMatcher = DECLARATION_PATTERN.matcher(customDeclaration); if (!declarationMatcher.matches()) { return null; @@ -83,8 +82,7 @@ final class CustomLogParser { return loggerType; } - @Nullable - static String parseLoggerInitializer(@NotNull String customDeclaration) { + static @Nullable String parseLoggerInitializer(@NotNull String customDeclaration) { final Matcher declarationMatcher = DECLARATION_PATTERN.matcher(customDeclaration); if (!declarationMatcher.matches()) { return null; @@ -97,8 +95,7 @@ final class CustomLogParser { * * @return null if declaration is invalid */ - @Nullable - static LoggerInitializerDeclaration parseInitializerParameters(@NotNull String customDeclaration) { + static @Nullable LoggerInitializerDeclaration parseInitializerParameters(@NotNull String customDeclaration) { final Matcher declarationMatcher = DECLARATION_PATTERN.matcher(customDeclaration); if (!declarationMatcher.matches()) { return null; @@ -128,8 +125,7 @@ final class CustomLogParser { return new LoggerInitializerDeclaration(withTopic, withoutTopic); } - @NotNull - private static List splitParameters(@NotNull String parameters) { + private static @NotNull List splitParameters(@NotNull String parameters) { if (parameters.isEmpty()) { return Collections.emptyList(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogProcessor.java index 825ba2aa74b0..bca698e71387 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/clazz/log/CustomLogProcessor.java @@ -23,14 +23,12 @@ public final class CustomLogProcessor extends AbstractLogProcessor { super(LombokClassNames.CUSTOM_LOG); } - @NotNull - private static String getCustomDeclaration(@NotNull PsiClass psiClass) { + private static @NotNull String getCustomDeclaration(@NotNull PsiClass psiClass) { return ConfigDiscovery.getInstance().getStringLombokConfigProperty(ConfigKey.LOG_CUSTOM_DECLARATION, psiClass); } - @Nullable @Override - public String getLoggerType(@NotNull PsiClass psiClass) { + public @Nullable String getLoggerType(@NotNull PsiClass psiClass) { return CustomLogParser.parseLoggerType(getCustomDeclaration(psiClass)); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AbstractFieldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AbstractFieldProcessor.java index 5b1caa074551..98d0f48a99f0 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AbstractFieldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AbstractFieldProcessor.java @@ -41,9 +41,8 @@ public abstract class AbstractFieldProcessor extends AbstractProcessor implement super(supportedClass, supportedAnnotationClass, equivalentAnnotationClass); } - @NotNull @Override - public List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { List result = new ArrayList<>(); Collection fields = psiClass.isRecord() ? RecordAugmentProvider.getFieldAugments(psiClass) : PsiClassUtil.collectClassFieldsIntern(psiClass); @@ -78,9 +77,8 @@ public abstract class AbstractFieldProcessor extends AbstractProcessor implement @NotNull List target, @Nullable String nameHint); - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { List result = new ArrayList<>(); for (PsiField psiField : PsiClassUtil.collectClassFieldsIntern(psiClass)) { PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, getSupportedAnnotationClasses()); @@ -91,9 +89,8 @@ public abstract class AbstractFieldProcessor extends AbstractProcessor implement return result; } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { Collection result = Collections.emptyList(); PsiField psiField = PsiTreeUtil.getParentOfType(psiAnnotation, PsiField.class); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AccessorsInfo.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AccessorsInfo.java index db733326d7e2..6221d244da3c 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AccessorsInfo.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/AccessorsInfo.java @@ -46,21 +46,19 @@ public class AccessorsInfo { this.prefixes = null == prefixes ? ArrayUtil.EMPTY_STRING_ARRAY : prefixes; } - @NotNull - public static AccessorsInfo build(boolean fluentValue, - boolean chainValue, - boolean makeFinal, - boolean doNotUseIsPrefix, - CapitalizationStrategy capitalizationStrategy, - String... prefixes) { + public static @NotNull AccessorsInfo build(boolean fluentValue, + boolean chainValue, + boolean makeFinal, + boolean doNotUseIsPrefix, + CapitalizationStrategy capitalizationStrategy, + String... prefixes) { return new AccessorsInfo(fluentValue, chainValue, makeFinal, doNotUseIsPrefix, capitalizationStrategy, prefixes); } - @NotNull - private static AccessorsInfo buildAccessorsInfo(@Nullable PsiClass psiClass, @Nullable Boolean chainDeclaredValue, - @Nullable Boolean fluentDeclaredValue, - @Nullable Boolean makeFinalDeclaredValue, - @NotNull Collection prefixDeclared) { + private static @NotNull AccessorsInfo buildAccessorsInfo(@Nullable PsiClass psiClass, @Nullable Boolean chainDeclaredValue, + @Nullable Boolean fluentDeclaredValue, + @Nullable Boolean makeFinalDeclaredValue, + @NotNull Collection prefixDeclared) { final boolean isFluent; final boolean isChained; final boolean makeFinal; @@ -158,8 +156,7 @@ public class AccessorsInfo { values.prefixes); } - @NotNull - public static AccessorsInfo buildFor(@NotNull PsiField psiField) { + public static @NotNull AccessorsInfo buildFor(@NotNull PsiField psiField) { final AccessorsValues fieldAccessorsValues = getAccessorsValues(psiField); final AccessorsValues classAccessorsValues = getAccessorsValues(psiField.getContainingClass()); final AccessorsValues combinedAccessorValues = fieldAccessorsValues.combine(classAccessorsValues); @@ -168,14 +165,12 @@ public class AccessorsInfo { return buildFrom(containingClass, combinedAccessorValues); } - @NotNull - public static AccessorsInfo buildFor(@NotNull PsiClass psiClass) { + public static @NotNull AccessorsInfo buildFor(@NotNull PsiClass psiClass) { AccessorsValues resultAccessorsValues = getAccessorsValues(psiClass); return buildFrom(psiClass, resultAccessorsValues); } - @NotNull - private static AccessorsValues getAccessorsValues(@NotNull PsiField psiField) { + private static @NotNull AccessorsValues getAccessorsValues(@NotNull PsiField psiField) { AccessorsValues accessorsValues = new AccessorsValues(); final PsiAnnotation accessorsFieldAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, LombokClassNames.ACCESSORS); if (null != accessorsFieldAnnotation) { @@ -184,8 +179,7 @@ public class AccessorsInfo { return accessorsValues; } - @NotNull - public static AccessorsValues getAccessorsValues(@Nullable PsiClass psiClass) { + public static @NotNull AccessorsValues getAccessorsValues(@Nullable PsiClass psiClass) { AccessorsValues resultAccessorsValues = new AccessorsValues(); PsiClass containingClass = psiClass; @@ -200,8 +194,7 @@ public class AccessorsInfo { return resultAccessorsValues; } - @NotNull - public static AccessorsInfo buildFor(@NotNull PsiField psiField, AccessorsValues classAccessorsValues) { + public static @NotNull AccessorsInfo buildFor(@NotNull PsiField psiField, AccessorsValues classAccessorsValues) { final AccessorsValues fieldAccessorsValues = getAccessorsValues(psiField); final AccessorsValues combinedAccessorValues = fieldAccessorsValues.combine(classAccessorsValues); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/FieldNameConstantsFieldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/FieldNameConstantsFieldProcessor.java index 3137907af8d1..de3e7bc08d31 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/FieldNameConstantsFieldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/FieldNameConstantsFieldProcessor.java @@ -81,10 +81,9 @@ public final class FieldNameConstantsFieldProcessor extends AbstractFieldProcess } } - @NotNull - public static PsiField createFieldNameConstant(@NotNull PsiField psiField, - @NotNull PsiClass psiClass, - @NotNull PsiAnnotation psiAnnotation) { + public static @NotNull PsiField createFieldNameConstant(@NotNull PsiField psiField, + @NotNull PsiClass psiClass, + @NotNull PsiAnnotation psiAnnotation) { final PsiManager manager = psiClass.getContainingFile().getManager(); final PsiType psiFieldType = PsiType.getJavaLangString(manager, GlobalSearchScope.allScope(psiClass.getProject())); @@ -106,8 +105,7 @@ public final class FieldNameConstantsFieldProcessor extends AbstractFieldProcess return fieldNameConstant; } - @NotNull - private static String calcFieldConstantName(@NotNull PsiField psiField, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiClass) { + private static @NotNull String calcFieldConstantName(@NotNull PsiField psiField, @NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass psiClass) { String prefix = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "prefix", CONFIG_DEFAULT); String suffix = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "suffix", CONFIG_DEFAULT); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/GetterFieldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/GetterFieldProcessor.java index db0cc5080b5b..3305d97f2df7 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/GetterFieldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/GetterFieldProcessor.java @@ -105,12 +105,11 @@ public final class GetterFieldProcessor extends AbstractFieldProcessor { return result; } - @Nullable @Contract("_,_,_,null -> !null") - public static PsiMethod createGetterMethod(@NotNull PsiField psiField, - @NotNull PsiClass psiClass, - @NotNull String methodModifier, - @Nullable String nameHint) { + public static @Nullable PsiMethod createGetterMethod(@NotNull PsiField psiField, + @NotNull PsiClass psiClass, + @NotNull String methodModifier, + @Nullable String nameHint) { final AccessorsInfo accessorsInfo = AccessorsInfo.buildFor(psiField); final String methodName = LombokUtils.getGetterName(psiField, accessorsInfo); if (nameHint != null && !nameHint.equals(methodName)) return null; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/SetterFieldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/SetterFieldProcessor.java index 55a8a70ae2ae..730aaceb43ba 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/SetterFieldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/SetterFieldProcessor.java @@ -106,9 +106,8 @@ public final class SetterFieldProcessor extends AbstractFieldProcessor { } @Contract("_,_,_,null -> !null") - @Nullable - public static PsiMethod createSetterMethod(@NotNull PsiField psiField, @NotNull PsiClass psiClass, @NotNull String methodModifier, - @Nullable String nameHint) { + public static @Nullable PsiMethod createSetterMethod(@NotNull PsiField psiField, @NotNull PsiClass psiClass, @NotNull String methodModifier, + @Nullable String nameHint) { final String fieldName = psiField.getName(); final PsiType psiFieldType = psiField.getType(); final PsiAnnotation setterAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiField, LombokClassNames.SETTER); @@ -161,12 +160,11 @@ public final class SetterFieldProcessor extends AbstractFieldProcessor { return methodBuilder; } - @NotNull - private static String createCodeBlockText(@NotNull PsiField psiField, - @NotNull PsiClass psiClass, - PsiType returnType, - boolean isStatic, - PsiParameter methodParameter) { + private static @NotNull String createCodeBlockText(@NotNull PsiField psiField, + @NotNull PsiClass psiClass, + PsiType returnType, + boolean isStatic, + PsiParameter methodParameter) { final String blockText; final String thisOrClass = isStatic ? psiClass.getName() : "this"; blockText = String.format("%s.%s = %s; ", thisOrClass, psiField.getName(), methodParameter.getName()); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/WitherFieldProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/WitherFieldProcessor.java index 583c7da7c3e5..de0c13ef64f0 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/WitherFieldProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/field/WitherFieldProcessor.java @@ -87,7 +87,7 @@ public final class WitherFieldProcessor extends AbstractFieldProcessor { return true; } - private static boolean validNonStatic(@NotNull PsiField psiField, @NotNull final ProblemSink builder) { + private static boolean validNonStatic(@NotNull PsiField psiField, final @NotNull ProblemSink builder) { if (psiField.hasModifierProperty(PsiModifier.STATIC)) { builder.addWarningMessage("inspection.message.not.generating.wither") .withLocalQuickFixes(()->PsiQuickFixFactory.createModifierListFix(psiField, PsiModifier.STATIC, false, false)); @@ -108,7 +108,7 @@ public final class WitherFieldProcessor extends AbstractFieldProcessor { return true; } - private boolean validIsWitherUnique(@NotNull PsiField psiField, @NotNull final ProblemSink builder) { + private boolean validIsWitherUnique(@NotNull PsiField psiField, final @NotNull ProblemSink builder) { final PsiClass fieldContainingClass = psiField.getContainingClass(); if (fieldContainingClass != null) { final Collection classMethods = filterToleratedElements(PsiClassUtil.collectClassMethodsIntern(fieldContainingClass)); @@ -182,8 +182,7 @@ public final class WitherFieldProcessor extends AbstractFieldProcessor { return result; } - @Nullable - public PsiMethod createWitherMethod(@NotNull PsiField psiField, @NotNull String methodModifier, @NotNull AccessorsInfo accessorsInfo) { + public @Nullable PsiMethod createWitherMethod(@NotNull PsiField psiField, @NotNull String methodModifier, @NotNull AccessorsInfo accessorsInfo) { LombokLightMethodBuilder methodBuilder = null; final PsiClass psiFieldContainingClass = psiField.getContainingClass(); if (psiFieldContainingClass != null) { diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/BuilderHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/BuilderHandler.java index f0d2a7c1fb85..c0499be31f8f 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/BuilderHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/BuilderHandler.java @@ -45,13 +45,13 @@ import static de.plushnikov.intellij.plugin.thirdparty.LombokAddNullAnnotations. * @author Michail Plushnikov */ public class BuilderHandler { - private final static String ANNOTATION_BUILDER_CLASS_NAME = "builderClassName"; + private static final String ANNOTATION_BUILDER_CLASS_NAME = "builderClassName"; private static final String ANNOTATION_BUILD_METHOD_NAME = "buildMethodName"; private static final String ANNOTATION_BUILDER_METHOD_NAME = "builderMethodName"; public static final String ANNOTATION_SETTER_PREFIX = "setterPrefix"; - private final static String BUILD_METHOD_NAME = "build"; - private final static String BUILDER_METHOD_NAME = "builder"; + private static final String BUILD_METHOD_NAME = "build"; + private static final String BUILDER_METHOD_NAME = "builder"; public static final String TO_BUILDER_METHOD_NAME = "toBuilder"; static final String TO_BUILDER_ANNOTATION_KEY = "toBuilder"; @@ -334,49 +334,42 @@ public class BuilderHandler { return result; } - @NotNull - public static String getBuildMethodName(@NotNull PsiAnnotation psiAnnotation) { + public static @NotNull String getBuildMethodName(@NotNull PsiAnnotation psiAnnotation) { final String buildMethodName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, ANNOTATION_BUILD_METHOD_NAME, BUILD_METHOD_NAME); return StringUtil.isEmptyOrSpaces(buildMethodName) ? BUILD_METHOD_NAME : buildMethodName; } - @NotNull - public String getBuilderMethodName(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull String getBuilderMethodName(@NotNull PsiAnnotation psiAnnotation) { final String builderMethodName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, ANNOTATION_BUILDER_METHOD_NAME, BUILDER_METHOD_NAME); return null == builderMethodName ? BUILDER_METHOD_NAME : builderMethodName; } - @NotNull - private static String getSetterPrefix(@NotNull PsiAnnotation psiAnnotation) { + private static @NotNull String getSetterPrefix(@NotNull PsiAnnotation psiAnnotation) { final String setterPrefix = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, ANNOTATION_SETTER_PREFIX, ""); return null == setterPrefix ? "" : setterPrefix; } - @NotNull @PsiModifier.ModifierConstant - private static String getBuilderOuterAccessVisibility(@NotNull PsiAnnotation psiAnnotation) { + private static @NotNull String getBuilderOuterAccessVisibility(@NotNull PsiAnnotation psiAnnotation) { final String accessVisibility = LombokProcessorUtil.getAccessVisibility(psiAnnotation); return null == accessVisibility ? PsiModifier.PUBLIC : accessVisibility; } - @NotNull @PsiModifier.ModifierConstant - private static String getBuilderInnerAccessVisibility(@NotNull PsiAnnotation psiAnnotation) { + private static @NotNull String getBuilderInnerAccessVisibility(@NotNull PsiAnnotation psiAnnotation) { final String accessVisibility = getBuilderOuterAccessVisibility(psiAnnotation); return PsiModifier.PROTECTED.equals(accessVisibility) ? PsiModifier.PUBLIC : accessVisibility; } - @NotNull - private static String getBuilderClassName(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + private static @NotNull String getBuilderClassName(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { return getBuilderClassName(psiClass, psiAnnotation, null); } - @NotNull - public static String getBuilderClassName(@NotNull PsiClass psiClass, - @NotNull PsiAnnotation psiAnnotation, - @Nullable PsiMethod psiMethod) { + public static @NotNull String getBuilderClassName(@NotNull PsiClass psiClass, + @NotNull PsiAnnotation psiAnnotation, + @Nullable PsiMethod psiMethod) { final String builderClassName = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, ANNOTATION_BUILDER_CLASS_NAME, ""); if (!StringUtil.isEmptyOrSpaces(builderClassName)) { return builderClassName; @@ -400,8 +393,7 @@ public class BuilderHandler { return getBuilderClassName(psiClass, relevantReturnType); } - @NotNull - static String getBuilderClassName(@NotNull PsiClass psiClass, @Nullable String returnTypeName) { + static @NotNull String getBuilderClassName(@NotNull PsiClass psiClass, @Nullable String returnTypeName) { final ConfigDiscovery configDiscovery = ConfigDiscovery.getInstance(); final String builderClassNamePattern = configDiscovery.getStringLombokConfigProperty(BUILDER_CLASS_NAME, psiClass); return replace(builderClassNamePattern, "*", capitalize(StringUtil.notNullize(returnTypeName))); @@ -546,8 +538,7 @@ public class BuilderHandler { return factory.createType(builderPsiClass, psiTypes); } - @NotNull - private static Stream createBuilderInfos(@NotNull PsiClass psiClass, @Nullable PsiMethod psiClassMethod) { + private static @NotNull Stream createBuilderInfos(@NotNull PsiClass psiClass, @Nullable PsiMethod psiClassMethod) { final Stream result; if (null != psiClassMethod) { result = Arrays.stream(psiClassMethod.getParameterList().getParameters()).map(BuilderInfo::fromPsiParameter); @@ -579,8 +570,7 @@ public class BuilderHandler { .collect(Collectors.toList()); } - @NotNull - public PsiClass createBuilderClass(@NotNull PsiClass psiClass, @Nullable PsiMethod psiMethod, @NotNull PsiAnnotation psiAnnotation) { + public @NotNull PsiClass createBuilderClass(@NotNull PsiClass psiClass, @Nullable PsiMethod psiMethod, @NotNull PsiAnnotation psiAnnotation) { final LombokLightClassBuilder builderClass; if (null != psiMethod) { builderClass = createEmptyBuilderClass(psiClass, psiMethod, psiAnnotation); @@ -650,8 +640,7 @@ public class BuilderHandler { LombokCopyableAnnotations.JACKSON_COPY_TO_BUILDER); } - @NotNull - private static PsiAnnotation createPojoBuilderAnnotation(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + private static @NotNull PsiAnnotation createPojoBuilderAnnotation(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { final StringBuilder parameters = new StringBuilder(); final String setterPrefix = getSetterPrefix(psiAnnotation); parameters.append("withPrefix=\""); @@ -668,16 +657,14 @@ public class BuilderHandler { .createAnnotationFromText('@' + JACKSON_DATABIND_ANNOTATION_JSON_POJOBUILDER + "(" + parameters + ")", psiClass); } - @NotNull - private static LombokLightClassBuilder createEmptyBuilderClass(@NotNull PsiClass psiClass, - @NotNull PsiMethod psiMethod, - @NotNull PsiAnnotation psiAnnotation) { + private static @NotNull LombokLightClassBuilder createEmptyBuilderClass(@NotNull PsiClass psiClass, + @NotNull PsiMethod psiMethod, + @NotNull PsiAnnotation psiAnnotation) { return createBuilderClass(psiClass, psiMethod, psiMethod.isConstructor() || psiMethod.hasModifierProperty(PsiModifier.STATIC), psiAnnotation); } - @NotNull - private static LombokLightClassBuilder createEmptyBuilderClass(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + private static @NotNull LombokLightClassBuilder createEmptyBuilderClass(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { return createBuilderClass(psiClass, psiClass, true, psiAnnotation); } @@ -691,8 +678,7 @@ public class BuilderHandler { return Optional.ofNullable(builderClass); } - @NotNull - public PsiMethod createToStringMethod(@NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass builderClass) { + public @NotNull PsiMethod createToStringMethod(@NotNull PsiAnnotation psiAnnotation, @NotNull PsiClass builderClass) { return createToStringMethod(psiAnnotation, builderClass, false); } @@ -715,11 +701,10 @@ public class BuilderHandler { return !isBuilderDefaultSetter; } - @NotNull - private static LombokLightClassBuilder createBuilderClass(@NotNull PsiClass psiClass, - @NotNull PsiTypeParameterListOwner psiTypeParameterListOwner, - final boolean isStatic, - @NotNull PsiAnnotation psiAnnotation) { + private static @NotNull LombokLightClassBuilder createBuilderClass(@NotNull PsiClass psiClass, + @NotNull PsiTypeParameterListOwner psiTypeParameterListOwner, + final boolean isStatic, + @NotNull PsiAnnotation psiAnnotation) { PsiMethod psiMethod = null; if (psiTypeParameterListOwner instanceof PsiMethod) { psiMethod = (PsiMethod)psiTypeParameterListOwner; @@ -741,8 +726,7 @@ public class BuilderHandler { return classBuilder; } - @NotNull - public static Collection createConstructors(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + public static @NotNull Collection createConstructors(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { final Collection methodsIntern = PsiClassUtil.collectClassConstructorIntern(psiClass); final NoArgsConstructorProcessor noArgsConstructorProcessor = getNoArgsConstructorProcessor(); final String constructorName = noArgsConstructorProcessor.getConstructorName(psiClass); @@ -754,13 +738,12 @@ public class BuilderHandler { return noArgsConstructorProcessor.createNoArgsConstructor(psiClass, PsiModifier.PACKAGE_LOCAL, psiAnnotation); } - @NotNull - public PsiMethod createBuildMethod(@NotNull PsiAnnotation psiAnnotation, - @NotNull PsiClass parentClass, - @Nullable PsiMethod psiMethod, - @NotNull PsiClass builderClass, - @NotNull String buildMethodName, - List builderInfos) { + public @NotNull PsiMethod createBuildMethod(@NotNull PsiAnnotation psiAnnotation, + @NotNull PsiClass parentClass, + @Nullable PsiMethod psiMethod, + @NotNull PsiClass builderClass, + @NotNull String buildMethodName, + List builderInfos) { final PsiType builderType = getReturnTypeOfBuildMethod(parentClass, psiMethod); final PsiSubstitutor builderSubstitutor = getBuilderSubstitutor(parentClass, builderClass); @@ -820,12 +803,11 @@ public class BuilderHandler { return true; } - @NotNull - private static String createBuildMethodCodeBlockText(@Nullable PsiMethod psiMethod, - @NotNull PsiClass psiClass, - @NotNull PsiType buildMethodReturnType, - @NotNull String buildMethodPrepare, - @NotNull String buildMethodParameters) { + private static @NotNull String createBuildMethodCodeBlockText(@Nullable PsiMethod psiMethod, + @NotNull PsiClass psiClass, + @NotNull PsiType buildMethodReturnType, + @NotNull String buildMethodPrepare, + @NotNull String buildMethodParameters) { final String blockText; final String codeBlockFormat, callExpressionText; @@ -847,8 +829,7 @@ public class BuilderHandler { return blockText; } - @NotNull - private static String calculateCallExpressionForMethod(@NotNull PsiMethod psiMethod, @NotNull PsiClass builderClass) { + private static @NotNull String calculateCallExpressionForMethod(@NotNull PsiMethod psiMethod, @NotNull PsiClass builderClass) { final PsiClass containingClass = psiMethod.getContainingClass(); StringBuilder className = new StringBuilder(); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/DelegateHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/DelegateHandler.java index e1b8c9803647..79ece69a85b5 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/DelegateHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/DelegateHandler.java @@ -234,12 +234,11 @@ public final class DelegateHandler { return !acceptMethod; } - @NotNull - private static PsiMethod generateDelegateMethod(@NotNull PsiClass psiClass, - @NotNull T psiElement, - @NotNull PsiAnnotation psiAnnotation, - @NotNull PsiMethod psiMethod, - @NotNull PsiSubstitutor psiSubstitutor) { + private static @NotNull PsiMethod generateDelegateMethod(@NotNull PsiClass psiClass, + @NotNull T psiElement, + @NotNull PsiAnnotation psiAnnotation, + @NotNull PsiMethod psiMethod, + @NotNull PsiSubstitutor psiSubstitutor) { final PsiType returnType = psiSubstitutor.substitute(psiMethod.getReturnType()); final LombokLightMethodBuilder methodBuilder = new LombokDelegateMethod(psiMethod) @@ -279,11 +278,10 @@ public final class DelegateHandler { return methodBuilder; } - @NotNull - private static String createCodeBlockText(@NotNull T psiElement, - @NotNull PsiMethod psiMethod, - @NotNull PsiType returnType, - PsiParameter @NotNull [] psiParameters) { + private static @NotNull String createCodeBlockText(@NotNull T psiElement, + @NotNull PsiMethod psiMethod, + @NotNull PsiType returnType, + PsiParameter @NotNull [] psiParameters) { final String paramString = Arrays.stream(psiParameters).map(PsiParameter::getName).collect(Collectors.joining(",")); final boolean isMethodCall = psiElement instanceof PsiMethod; return String.format("%sthis.%s%s.%s(%s);", diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/FieldNameConstantsHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/FieldNameConstantsHandler.java index a26094e6c4fd..6b7ffe8642d5 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/FieldNameConstantsHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/FieldNameConstantsHandler.java @@ -32,8 +32,7 @@ public final class FieldNameConstantsHandler { return typeName; } - @Nullable - public static LombokLightClassBuilder createInnerClassOrEnum(@NotNull String name, @NotNull PsiClass containingClass, @NotNull PsiAnnotation psiAnnotation) { + public static @Nullable LombokLightClassBuilder createInnerClassOrEnum(@NotNull String name, @NotNull PsiClass containingClass, @NotNull PsiAnnotation psiAnnotation) { final String accessLevel = LombokProcessorUtil.getLevelVisibility(psiAnnotation); if (accessLevel == null) { return null; @@ -66,8 +65,7 @@ public final class FieldNameConstantsHandler { }).collect(Collectors.toList()); } - @NotNull - private static LombokLightClassBuilder createEnum(@NotNull String name, @NotNull PsiClass containingClass, @NotNull String accessLevel, @NotNull PsiElement navigationElement) { + private static @NotNull LombokLightClassBuilder createEnum(@NotNull String name, @NotNull PsiClass containingClass, @NotNull String accessLevel, @NotNull PsiElement navigationElement) { final String innerClassQualifiedName = containingClass.getQualifiedName() + "." + name; final LombokLightClassBuilder lazyClassBuilder = new LombokLightClassBuilder(containingClass, name, innerClassQualifiedName); lazyClassBuilder.withContainingClass(containingClass) @@ -121,8 +119,7 @@ public final class FieldNameConstantsHandler { return makeUppercased ? LombokUtils.camelCaseToConstant(fieldName) : fieldName; } - @NotNull - private static LombokLightClassBuilder createInnerClass(@NotNull String name, @NotNull PsiClass containingClass, @NotNull String accessLevel, @NotNull PsiElement navigationElement) { + private static @NotNull LombokLightClassBuilder createInnerClass(@NotNull String name, @NotNull PsiClass containingClass, @NotNull String accessLevel, @NotNull PsiElement navigationElement) { final String innerClassQualifiedName = containingClass.getQualifiedName() + "." + name; final LombokLightClassBuilder lazyClassBuilder = new LombokLightClassBuilder(containingClass, name, innerClassQualifiedName); lazyClassBuilder.withContainingClass(containingClass) @@ -133,8 +130,7 @@ public final class FieldNameConstantsHandler { return lazyClassBuilder; } - @NotNull - private static PsiField createFieldNameConstant(@NotNull PsiMember psiMember, boolean makeUppercased, @NotNull PsiClass containingClass) { + private static @NotNull PsiField createFieldNameConstant(@NotNull PsiMember psiMember, boolean makeUppercased, @NotNull PsiClass containingClass) { final PsiManager manager = containingClass.getContainingFile().getManager(); final PsiType fieldNameConstType = PsiType.getJavaLangString(manager, GlobalSearchScope.allScope(containingClass.getProject())); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/SuperBuilderHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/SuperBuilderHandler.java index 65a93c026d1f..23aac44f7d85 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/SuperBuilderHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/SuperBuilderHandler.java @@ -89,13 +89,11 @@ public class SuperBuilderHandler extends BuilderHandler { return true; } - @NotNull - public String getBuilderClassName(@NotNull PsiClass psiClass) { + public @NotNull String getBuilderClassName(@NotNull PsiClass psiClass) { return getBuilderClassName(psiClass, psiClass.getName()); } - @NotNull - public String getBuilderImplClassName(@NotNull PsiClass psiClass) { + public @NotNull String getBuilderImplClassName(@NotNull PsiClass psiClass) { return getBuilderClassName(psiClass) + "Impl"; } @@ -206,8 +204,7 @@ public class SuperBuilderHandler extends BuilderHandler { return result; } - @NotNull - public PsiClass createBuilderBaseClass(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { + public @NotNull PsiClass createBuilderBaseClass(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { String builderClassName = getBuilderClassName(psiClass); String builderClassQualifiedName = psiClass.getQualifiedName() + "." + builderClassName; @@ -269,9 +266,8 @@ public class SuperBuilderHandler extends BuilderHandler { return baseClassBuilder; } - @NotNull - private List createBuilderInfos(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, - @NotNull PsiClass baseClassBuilder) { + private @NotNull List createBuilderInfos(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, + @NotNull PsiClass baseClassBuilder) { final List builderInfos = createBuilderInfos(psiAnnotation, psiClass, null, baseClassBuilder); for (BuilderInfo builderInfo : builderInfos) { builderInfo.withBuilderChainResult("self()") @@ -409,8 +405,7 @@ public class SuperBuilderHandler extends BuilderHandler { return result; } - @NotNull - public PsiClass createBuilderImplClass(@NotNull PsiClass psiClass, @NotNull PsiClass psiBaseBuilderClass, PsiAnnotation psiAnnotation) { + public @NotNull PsiClass createBuilderImplClass(@NotNull PsiClass psiClass, @NotNull PsiClass psiBaseBuilderClass, PsiAnnotation psiAnnotation) { String builderClassName = getBuilderImplClassName(psiClass); String builderClassQualifiedName = psiClass.getQualifiedName() + "." + builderClassName; @@ -494,14 +489,12 @@ public class SuperBuilderHandler extends BuilderHandler { return result; } - @NotNull - public static PsiClassType getTypeWithWildcardsForSuperBuilderTypeParameters(@NotNull PsiClass psiClass) { + public static @NotNull PsiClassType getTypeWithWildcardsForSuperBuilderTypeParameters(@NotNull PsiClass psiClass) { final PsiWildcardType wildcardType = PsiWildcardType.createUnbounded(psiClass.getManager()); return getTypeWithSpecificTypeParameters(psiClass, wildcardType, wildcardType); } - @NotNull - private static PsiClassType getTypeWithSpecificTypeParameters(@NotNull PsiClass psiClass, PsiType @NotNull ... psiTypes) { + private static @NotNull PsiClassType getTypeWithSpecificTypeParameters(@NotNull PsiClass psiClass, PsiType @NotNull ... psiTypes) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiClass.getProject()); final PsiTypeParameter[] classTypeParameters = psiClass.getTypeParameters(); final int substituteTypesCount = psiTypes.length; diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/AbstractSingularHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/AbstractSingularHandler.java index 9bba34a11687..bd301b6466ca 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/AbstractSingularHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/AbstractSingularHandler.java @@ -40,8 +40,7 @@ public abstract class AbstractSingularHandler implements BuilderElementHandler { .withNavigationElement(info.getVariable())); } - @NotNull - protected PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { + protected @NotNull PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { final PsiManager psiManager = PsiManager.getInstance(project); final PsiType elementType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager); @@ -131,8 +130,7 @@ public abstract class AbstractSingularHandler implements BuilderElementHandler { return methods; } - @NotNull - private static String createSingularClearMethodName(String fieldName, CapitalizationStrategy capitalizationStrategy) { + private static @NotNull String createSingularClearMethodName(String fieldName, CapitalizationStrategy capitalizationStrategy) { return LombokUtils.buildAccessorName("clear", fieldName, capitalizationStrategy); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularCollectionHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularCollectionHandler.java index 2a802eb22ad1..407154d19b01 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularCollectionHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularCollectionHandler.java @@ -19,13 +19,11 @@ class SingularCollectionHandler extends AbstractSingularHandler { super(qualifiedName); } - @NotNull - private static PsiType getOneElementType(@NotNull PsiType psiFieldType, PsiManager psiManager) { + private static @NotNull PsiType getOneElementType(@NotNull PsiType psiFieldType, PsiManager psiManager) { return PsiTypeUtil.extractOneElementType(psiFieldType, psiManager); } - @NotNull - private static PsiType getCollectionType(@NotNull PsiType psiFieldType, @NotNull PsiManager psiManager) { + private static @NotNull PsiType getCollectionType(@NotNull PsiType psiFieldType, @NotNull PsiManager psiManager) { final PsiType elementType = PsiTypeUtil.extractAllElementType(psiFieldType, psiManager); return PsiTypeUtil.createCollectionType(psiManager, CommonClassNames.JAVA_UTIL_COLLECTION, elementType); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaCollectionHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaCollectionHandler.java index b453617ebeac..6914bd4cb92d 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaCollectionHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaCollectionHandler.java @@ -25,8 +25,7 @@ class SingularGuavaCollectionHandler extends SingularCollectionHandler { ? SingularCollectionClassNames.GUAVA_IMMUTABLE_LIST : collectionQualifiedName; } - @NotNull - private static PsiType getCollectionType(@NotNull PsiType psiFieldType, PsiManager psiManager) { + private static @NotNull PsiType getCollectionType(@NotNull PsiType psiFieldType, PsiManager psiManager) { final PsiType elementType = PsiTypeUtil.extractAllElementType(psiFieldType, psiManager); return PsiTypeUtil.createCollectionType(psiManager, CommonClassNames.JAVA_LANG_ITERABLE, elementType); } @@ -38,8 +37,7 @@ class SingularGuavaCollectionHandler extends SingularCollectionHandler { } @Override - @NotNull - protected PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { + protected @NotNull PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { final PsiManager psiManager = PsiManager.getInstance(project); final PsiType elementType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaMapHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaMapHandler.java index dc60e1b32042..be8375f3f6db 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaMapHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaMapHandler.java @@ -34,8 +34,7 @@ class SingularGuavaMapHandler extends SingularMapHandler { } @Override - @NotNull - protected PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { + protected @NotNull PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { final PsiManager psiManager = PsiManager.getInstance(project); final PsiType keyType = getKeyType(psiFieldType, psiManager); final PsiType valueType = getValueType(psiFieldType, psiManager); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaTableHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaTableHandler.java index 3d0eb6b1e7d8..47a66302882b 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaTableHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularGuavaTableHandler.java @@ -38,24 +38,20 @@ class SingularGuavaTableHandler extends SingularMapHandler { } - @NotNull - private static PsiType getRowKeyType(@NotNull PsiType psiFieldType, PsiManager psiManager) { + private static @NotNull PsiType getRowKeyType(@NotNull PsiType psiFieldType, PsiManager psiManager) { return PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 0); } - @NotNull - private static PsiType getColumnKeyType(@NotNull PsiType psiFieldType, PsiManager psiManager) { + private static @NotNull PsiType getColumnKeyType(@NotNull PsiType psiFieldType, PsiManager psiManager) { return PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 1); } @Override - @NotNull - protected PsiType getValueType(@NotNull PsiType psiFieldType, PsiManager psiManager) { + protected @NotNull PsiType getValueType(@NotNull PsiType psiFieldType, PsiManager psiManager) { return PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 2); } - @NotNull - private static PsiType getCollectionType(@NotNull PsiType psiFieldType, PsiManager psiManager) { + private static @NotNull PsiType getCollectionType(@NotNull PsiType psiFieldType, PsiManager psiManager) { final PsiType rowKeyType = PsiTypeUtil.extractAllElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 0); final PsiType columnKeyType = PsiTypeUtil.extractAllElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 1); final PsiType valueType = PsiTypeUtil.extractAllElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 2); @@ -64,8 +60,7 @@ class SingularGuavaTableHandler extends SingularMapHandler { } @Override - @NotNull - protected PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { + protected @NotNull PsiType getBuilderFieldType(@NotNull PsiType psiFieldType, @NotNull Project project) { final PsiManager psiManager = PsiManager.getInstance(project); final PsiType rowKeyType = getRowKeyType(psiFieldType, psiManager); final PsiType columnKeyType = getColumnKeyType(psiFieldType, psiManager); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularHandlerFactory.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularHandlerFactory.java index 36c0f9fd884d..bd9eb6ecfa13 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularHandlerFactory.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularHandlerFactory.java @@ -44,8 +44,7 @@ public final class SingularHandlerFactory { return elements.contains(className) || ContainerUtil.exists(elements, t -> t.endsWith("." + className)); } - @NotNull - public static BuilderElementHandler getHandlerFor(@NotNull PsiVariable psiVariable, boolean hasSingularAnnotation) { + public static @NotNull BuilderElementHandler getHandlerFor(@NotNull PsiVariable psiVariable, boolean hasSingularAnnotation) { if (!hasSingularAnnotation) { return new NonSingularHandler(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularMapHandler.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularMapHandler.java index 79bb76c2f6d5..2ac84b00f4f6 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularMapHandler.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/handler/singular/SingularMapHandler.java @@ -23,13 +23,11 @@ class SingularMapHandler extends AbstractSingularHandler { super(qualifiedName); } - @NotNull - protected static PsiType getKeyType(PsiType psiFieldType, PsiManager psiManager) { + protected static @NotNull PsiType getKeyType(PsiType psiFieldType, PsiManager psiManager) { return PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 0); } - @NotNull - protected PsiType getValueType(PsiType psiFieldType, PsiManager psiManager) { + protected @NotNull PsiType getValueType(PsiType psiFieldType, PsiManager psiManager) { return PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 1); } @@ -53,14 +51,12 @@ class SingularMapHandler extends AbstractSingularHandler { } @Override - @NotNull - protected PsiType getBuilderFieldType(@NotNull PsiType psiType, @NotNull Project project) { + protected @NotNull PsiType getBuilderFieldType(@NotNull PsiType psiType, @NotNull Project project) { final PsiManager psiManager = PsiManager.getInstance(project); return PsiTypeUtil.createCollectionType(psiManager, CommonClassNames.JAVA_UTIL_ARRAY_LIST, psiType); } - @NotNull - private static PsiType getCollectionType(PsiType info, PsiManager psiManager) { + private static @NotNull PsiType getCollectionType(PsiType info, PsiManager psiManager) { final PsiType keyType = PsiTypeUtil.extractAllElementType(info, psiManager, CommonClassNames.JAVA_UTIL_MAP, 0); final PsiType valueType = PsiTypeUtil.extractAllElementType(info, psiManager, CommonClassNames.JAVA_UTIL_MAP, 1); return PsiTypeUtil.createCollectionType(psiManager, CommonClassNames.JAVA_UTIL_MAP, keyType, valueType); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/lombok/LombokAnnotationProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/lombok/LombokAnnotationProcessor.java index b10f28fd588d..e6b682ba0d7f 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/lombok/LombokAnnotationProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/lombok/LombokAnnotationProcessor.java @@ -44,8 +44,7 @@ public final class LombokAnnotationProcessor { * @return the list of augmented PsiMethods or empty list * @see Lombok onX */ - @NotNull - public static List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public static @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { if (nameHint != null && !config.containsKey(nameHint)) { return Collections.emptyList(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/method/AbstractMethodProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/method/AbstractMethodProcessor.java index 7620abb9fa76..54da188911ac 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/method/AbstractMethodProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/method/AbstractMethodProcessor.java @@ -38,9 +38,8 @@ public abstract class AbstractMethodProcessor extends AbstractProcessor implemen super(supportedClass, supportedAnnotationClass, equivalentAnnotationClass); } - @NotNull @Override - public List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { + public @NotNull List process(@NotNull PsiClass psiClass, @Nullable String nameHint) { List result = new ArrayList<>(); for (PsiMethod psiMethod : PsiClassUtil.collectClassMethodsIntern(psiClass)) { PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotationByShortNameOnly(psiMethod, getSupportedAnnotationClasses()); @@ -66,9 +65,8 @@ public abstract class AbstractMethodProcessor extends AbstractProcessor implemen return true; } - @NotNull @Override - public Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { + public @NotNull Collection collectProcessedAnnotations(@NotNull PsiClass psiClass) { List result = new ArrayList<>(); for (PsiMethod psiMethod : PsiClassUtil.collectClassMethodsIntern(psiClass)) { PsiAnnotation psiAnnotation = PsiAnnotationSearchUtil.findAnnotation(psiMethod, getSupportedAnnotationClasses()); @@ -79,9 +77,8 @@ public abstract class AbstractMethodProcessor extends AbstractProcessor implemen return result; } - @NotNull @Override - public Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { + public @NotNull Collection verifyAnnotation(@NotNull PsiAnnotation psiAnnotation) { Collection result = Collections.emptyList(); PsiMethod psiMethod = PsiTreeUtil.getParentOfType(psiAnnotation, PsiMethod.class); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/FieldDefaultsModifierProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/FieldDefaultsModifierProcessor.java index df62481995dd..699d09deb2d1 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/FieldDefaultsModifierProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/FieldDefaultsModifierProcessor.java @@ -42,7 +42,7 @@ public class FieldDefaultsModifierProcessor implements ModifierProcessor { } @Override - public void transformModifiers(@NotNull PsiModifierList modifierList, @NotNull final Set modifiers) { + public void transformModifiers(@NotNull PsiModifierList modifierList, final @NotNull Set modifiers) { if (modifiers.contains(PsiModifier.STATIC) || UtilityClassModifierProcessor.isModifierListSupported(modifierList)) { return; // skip static fields } @@ -52,7 +52,7 @@ public class FieldDefaultsModifierProcessor implements ModifierProcessor { return; // Should not get here, but safer to check } - @Nullable final PsiAnnotation fieldDefaultsAnnotation = PsiAnnotationSearchUtil.findAnnotation(searchableClass, + final @Nullable PsiAnnotation fieldDefaultsAnnotation = PsiAnnotationSearchUtil.findAnnotation(searchableClass, LombokClassNames.FIELD_DEFAULTS); final boolean isConfigDefaultFinal = isConfigDefaultFinal(searchableClass); final boolean isConfigDefaultPrivate = isConfigDefaultPrivate(searchableClass); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ModifierProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ModifierProcessor.java index 06d15856b8e9..c6c4a5299f0c 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ModifierProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ModifierProcessor.java @@ -29,5 +29,5 @@ public interface ModifierProcessor { * @param modifierList Modifier List that will have mosifiers augmented * @param modifiers Set of modifiers that is currently present for the list */ - void transformModifiers(@NotNull PsiModifierList modifierList, @NotNull final Set modifiers); + void transformModifiers(@NotNull PsiModifierList modifierList, final @NotNull Set modifiers); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/UtilityClassModifierProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/UtilityClassModifierProcessor.java index c82759d5c82d..00d32a6cf1dc 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/UtilityClassModifierProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/UtilityClassModifierProcessor.java @@ -39,7 +39,7 @@ public class UtilityClassModifierProcessor implements ModifierProcessor { } @Override - public void transformModifiers(@NotNull PsiModifierList modifierList, @NotNull final Set modifiers) { + public void transformModifiers(@NotNull PsiModifierList modifierList, final @NotNull Set modifiers) { final PsiElement parent = modifierList.getParent(); // FINAL diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValModifierProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValModifierProcessor.java index 42e51da7fb13..b1c9fe85b028 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValModifierProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValModifierProcessor.java @@ -22,7 +22,7 @@ public class ValModifierProcessor implements ModifierProcessor { } @Override - public void transformModifiers(@NotNull PsiModifierList modifierList, @NotNull final Set modifiers) { + public void transformModifiers(@NotNull PsiModifierList modifierList, final @NotNull Set modifiers) { modifiers.add(PsiModifier.FINAL); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValueModifierProcessor.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValueModifierProcessor.java index 8030ead64ab7..b97376f66918 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValueModifierProcessor.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/processor/modifier/ValueModifierProcessor.java @@ -29,7 +29,7 @@ public class ValueModifierProcessor implements ModifierProcessor { } @Override - public void transformModifiers(@NotNull PsiModifierList modifierList, @NotNull final Set modifiers) { + public void transformModifiers(@NotNull PsiModifierList modifierList, final @NotNull Set modifiers) { if (modifiers.contains(PsiModifier.STATIC) && modifierList.getParent() instanceof PsiField) { return; // skip static fields } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAnnotationSupport.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAnnotationSupport.java index 163217bd60a5..b81131641043 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAnnotationSupport.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAnnotationSupport.java @@ -9,9 +9,8 @@ import java.util.Collections; import java.util.List; final class LombokAnnotationSupport implements AnnotationPackageSupport { - @NotNull @Override - public List getNullabilityAnnotations(@NotNull Nullability nullability) { + public @NotNull List getNullabilityAnnotations(@NotNull Nullability nullability) { if (nullability == Nullability.NOT_NULL) { return Collections.singletonList("lombok.NonNull"); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java index 3c6eebc4c039..4d2a256efbf1 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java @@ -44,9 +44,8 @@ public final class LombokAugmentProvider extends PsiAugmentProvider implements P return Registry.is("lombok.dumb.mode.enabled", false); } - @NotNull @Override - protected Set transformModifiers(@NotNull PsiModifierList modifierList, @NotNull final Set modifiers) { + protected @NotNull Set transformModifiers(@NotNull PsiModifierList modifierList, final @NotNull Set modifiers) { // skip if no lombok library is present if (!hasLombokLibrary(modifierList.getProject()) && !DumbIncompleteModeUtil.isIncompleteModeWithLombokAnnotation(modifierList)) { return modifiers; @@ -123,27 +122,24 @@ public final class LombokAugmentProvider extends PsiAugmentProvider implements P return isLazyGetter; } - @Nullable @Override - protected PsiType inferType(@NotNull PsiTypeElement typeElement) { + protected @Nullable PsiType inferType(@NotNull PsiTypeElement typeElement) { //skip if dumb mode, allow only `getAugments` if (DumbService.isDumb(typeElement.getProject())) return null; return hasLombokLibrary(typeElement.getProject()) ? ValProcessor.inferType(typeElement) : null; } - @NotNull @Override - public List getAugments(@NotNull PsiElement element, - @NotNull final Class type) { + public @NotNull List getAugments(@NotNull PsiElement element, + final @NotNull Class type) { return getAugments(element, type, null); } - @NotNull @Override - public List getAugments(@NotNull PsiElement element, - @NotNull final Class type, - @Nullable String nameHint) { + public @NotNull List getAugments(@NotNull PsiElement element, + final @NotNull Class type, + @Nullable String nameHint) { final List emptyResult = Collections.emptyList(); if (type != PsiClass.class && type != PsiField.class && type != PsiMethod.class || !(element instanceof PsiExtensibleClass psiClass)) { return emptyResult; @@ -177,8 +173,7 @@ public final class LombokAugmentProvider extends PsiAugmentProvider implements P return getPsis(psiClass, type, nameHint); } - @NotNull - private static List getPsis(PsiClass psiClass, Class type, String nameHint) { + private static @NotNull List getPsis(PsiClass psiClass, Class type, String nameHint) { final List result = new ArrayList<>(); for (Processor processor : LombokProcessorManager.getProcessors(type)) { final List generatedElements = processor.process(psiClass, nameHint); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokEnumConstantBuilder.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokEnumConstantBuilder.java index 72f6edda5d5e..b3fe011de31b 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokEnumConstantBuilder.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokEnumConstantBuilder.java @@ -9,40 +9,34 @@ public class LombokEnumConstantBuilder extends LombokLightFieldBuilder implement super(manager, name, type); } - @Nullable @Override - public PsiExpressionList getArgumentList() { + public @Nullable PsiExpressionList getArgumentList() { return null; } - @Nullable @Override - public PsiEnumConstantInitializer getInitializingClass() { + public @Nullable PsiEnumConstantInitializer getInitializingClass() { return null; } - @NotNull @Override - public PsiEnumConstantInitializer getOrCreateInitializingClass() { + public @NotNull PsiEnumConstantInitializer getOrCreateInitializingClass() { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject()); return factory.createEnumConstantFromText("foo{}", null).getInitializingClass(); } - @Nullable @Override - public PsiMethod resolveMethod() { + public @Nullable PsiMethod resolveMethod() { return null; } - @NotNull @Override - public JavaResolveResult resolveMethodGenerics() { + public @NotNull JavaResolveResult resolveMethodGenerics() { return JavaResolveResult.EMPTY; } - @Nullable @Override - public PsiMethod resolveConstructor() { + public @Nullable PsiMethod resolveConstructor() { return null; } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightClassBuilder.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightClassBuilder.java index bb11d23774af..db5ceba3e82a 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightClassBuilder.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightClassBuilder.java @@ -43,9 +43,8 @@ public class LombokLightClassBuilder extends LightPsiClassBuilder implements Psi myModifierList = new LombokLightModifierList(context.getManager(), context.getLanguage()).withParent(this); } - @NotNull @Override - public LombokLightModifierList getModifierList() { + public @NotNull LombokLightModifierList getModifierList() { return myModifierList; } @@ -62,9 +61,8 @@ public class LombokLightClassBuilder extends LightPsiClassBuilder implements Psi return getContainingClass(); } - @Nullable @Override - public String getQualifiedName() { + public @Nullable String getQualifiedName() { return myQualifiedName; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightFieldBuilder.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightFieldBuilder.java index 2764bd86da2e..ab154a7b6751 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightFieldBuilder.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightFieldBuilder.java @@ -41,8 +41,7 @@ public class LombokLightFieldBuilder extends LightFieldBuilder implements Synthe } @Override - @NotNull - public LombokLightModifierList getModifierList() { + public @NotNull LombokLightModifierList getModifierList() { return myModifierList; } @@ -64,9 +63,8 @@ public class LombokLightFieldBuilder extends LightFieldBuilder implements Synthe return myModifierList.hasModifierProperty(name); } - @Nullable @Override - public PsiFile getContainingFile() { + public @Nullable PsiFile getContainingFile() { PsiClass containingClass = getContainingClass(); return containingClass != null ? containingClass.getContainingFile() : null; } @@ -96,9 +94,8 @@ public class LombokLightFieldBuilder extends LightFieldBuilder implements Synthe return this; } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return myName; } @@ -109,9 +106,8 @@ public class LombokLightFieldBuilder extends LightFieldBuilder implements Synthe return this; } - @NotNull @Override - public PsiIdentifier getNameIdentifier() { + public @NotNull PsiIdentifier getNameIdentifier() { return myNameIdentifier; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightMethodBuilder.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightMethodBuilder.java index 45dde66c0d2c..a509983f94c3 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightMethodBuilder.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightMethodBuilder.java @@ -86,8 +86,7 @@ public class LombokLightMethodBuilder extends LightMethodBuilder implements Synt return withParameter(createParameter(name, type)); } - @NotNull - private LombokLightParameter createParameter(@NotNull String name, @NotNull PsiType type) { + private @NotNull LombokLightParameter createParameter(@NotNull String name, @NotNull PsiType type) { return new LombokLightParameter(name, type, this, JavaLanguage.INSTANCE); } @@ -222,9 +221,8 @@ public class LombokLightMethodBuilder extends LightMethodBuilder implements Synt return result; } - @Nullable @Override - public PsiFile getContainingFile() { + public @Nullable PsiFile getContainingFile() { PsiClass containingClass = getContainingClass(); return containingClass != null ? containingClass.getContainingFile() : null; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightModifierList.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightModifierList.java index 841cb822bce0..5188d69f68b2 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightModifierList.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightModifierList.java @@ -94,8 +94,7 @@ public class LombokLightModifierList extends LightModifierList implements Synthe } @Override - @NotNull - public PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) { + public @NotNull PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(getProject()); final PsiAnnotation psiAnnotation = elementFactory.createAnnotationFromText('@' + qualifiedName, null); myAnnotations.put(qualifiedName, psiAnnotation); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightParameter.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightParameter.java index 566d63ca4a89..08c5f9e5c38a 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightParameter.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/psi/LombokLightParameter.java @@ -30,9 +30,8 @@ public class LombokLightParameter extends LightParameter implements SyntheticEle myNameIdentifier = new LombokLightIdentifier(declarationScope.getManager(), name); } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return myNameIdentifier.getText(); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/AddAbstractAndStaticModifiersFix.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/AddAbstractAndStaticModifiersFix.java index 1a0a4584030d..dad90e63adb1 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/AddAbstractAndStaticModifiersFix.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/AddAbstractAndStaticModifiersFix.java @@ -33,9 +33,8 @@ public class AddAbstractAndStaticModifiersFix extends PsiUpdateModCommandAction< return Presentation.of(LombokBundle.message("make.abstract.and.static.modifier.quickfix", myName)); } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return LombokBundle.message("make.abstract.and.static.modifier.quickfix.family.name"); } } \ No newline at end of file diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/CreateFieldQuickFix.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/CreateFieldQuickFix.java index d8ca7c9f0eb4..65db4a402460 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/CreateFieldQuickFix.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/CreateFieldQuickFix.java @@ -33,8 +33,7 @@ public class CreateFieldQuickFix extends PsiUpdateModCommandAction { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return LombokBundle.message("intention.name.create.new.field.s", myName); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/PsiQuickFixFactory.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/PsiQuickFixFactory.java index ae4f0690990e..c5151034893e 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/PsiQuickFixFactory.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/PsiQuickFixFactory.java @@ -25,8 +25,7 @@ public final class PsiQuickFixFactory { return new AddAnnotationFix(annotationFQN, psiClass, attributes, ExternalAnnotationsManager.AnnotationPlace.IN_CODE); } - @NotNull - public static AddAnnotationFix createAddAnnotationFix(@NotNull String annotationFQN, @NotNull PsiModifierListOwner targetForAnnotation) { + public static @NotNull AddAnnotationFix createAddAnnotationFix(@NotNull String annotationFQN, @NotNull PsiModifierListOwner targetForAnnotation) { return new AddAnnotationFix(annotationFQN, targetForAnnotation, PsiNameValuePair.EMPTY_ARRAY, ExternalAnnotationsManager.AnnotationPlace.IN_CODE); } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/UseSlf4jAnnotationQuickFix.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/UseSlf4jAnnotationQuickFix.java index 34e81c452126..198565388eeb 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/UseSlf4jAnnotationQuickFix.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/quickfix/UseSlf4jAnnotationQuickFix.java @@ -19,8 +19,7 @@ import static de.plushnikov.intellij.plugin.processor.clazz.log.AbstractLogProce public class UseSlf4jAnnotationQuickFix extends PsiUpdateModCommandAction { - @NotNull - private final SmartPsiElementPointer elementToRemove; + private final @NotNull SmartPsiElementPointer elementToRemove; public UseSlf4jAnnotationQuickFix(@NotNull PsiField elementToRemove, @NotNull PsiClass containingClass) { super(containingClass); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/resolver/LombokExternalLibraryResolver.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/resolver/LombokExternalLibraryResolver.java index 60039077ac5b..97f167e92550 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/resolver/LombokExternalLibraryResolver.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/resolver/LombokExternalLibraryResolver.java @@ -31,20 +31,18 @@ public final class LombokExternalLibraryResolver extends ExternalLibraryResolver simpleNameToFQNameMap = MAIN_LOMBOK_CLASSES.stream().collect(Collectors.toMap(StringUtil::getShortName, Function.identity())); } - @Nullable @Override - public ExternalClassResolveResult resolveClass(@NotNull String shortClassName, - @NotNull ThreeState isAnnotation, - @NotNull Module contextModule) { + public @Nullable ExternalClassResolveResult resolveClass(@NotNull String shortClassName, + @NotNull ThreeState isAnnotation, + @NotNull Module contextModule) { if (isAnnotation == ThreeState.YES && simpleNameToFQNameMap.containsKey(shortClassName)) { return new ExternalClassResolveResult(simpleNameToFQNameMap.get(shortClassName), LOMBOK_DESCRIPTOR); } return null; } - @Nullable @Override - public ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) { + public @Nullable ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) { if (allLombokPackages.contains(packageName)) { return LOMBOK_DESCRIPTOR; } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/settings/ProjectSettingsPage.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/settings/ProjectSettingsPage.java index 9364b4c53797..448df1b31336 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/settings/ProjectSettingsPage.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/settings/ProjectSettingsPage.java @@ -23,9 +23,8 @@ public final class ProjectSettingsPage implements SearchableConfigurable, Config myProject = project; } - @Nls @Override - public String getDisplayName() { + public @Nls String getDisplayName() { return LombokBundle.message("plugin.settings.title"); } @@ -55,9 +54,8 @@ public final class ProjectSettingsPage implements SearchableConfigurable, Config initFromSettings(); } - @NotNull @Override - public String getId() { + public @NotNull String getId() { return getDisplayName(); } } diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/LombokProcessorUtil.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/LombokProcessorUtil.java index d8f70ee1dc7a..05c841278785 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/LombokProcessorUtil.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/LombokProcessorUtil.java @@ -16,18 +16,12 @@ import java.util.*; */ public final class LombokProcessorUtil { - @NonNls - private static final String ACCESS_LEVEL_PRIVATE = "PRIVATE"; - @NonNls - private static final String ACCESS_LEVEL_PROTECTED = "PROTECTED"; - @NonNls - private static final String ACCESS_LEVEL_PACKAGE_LOCAL = "PACKAGE"; - @NonNls - private static final String ACCESS_LEVEL_PUBLIC = "PUBLIC"; - @NonNls - private static final String ACCESS_LEVEL_NONE = "NONE"; - @NonNls - private static final String ACCESS_LEVEL_MODULE = "MODULE"; + private static final @NonNls String ACCESS_LEVEL_PRIVATE = "PRIVATE"; + private static final @NonNls String ACCESS_LEVEL_PROTECTED = "PROTECTED"; + private static final @NonNls String ACCESS_LEVEL_PACKAGE_LOCAL = "PACKAGE"; + private static final @NonNls String ACCESS_LEVEL_PUBLIC = "PUBLIC"; + private static final @NonNls String ACCESS_LEVEL_NONE = "NONE"; + private static final @NonNls String ACCESS_LEVEL_MODULE = "MODULE"; private static final Map ACCESS_LEVEL_MAP = Map.of( PsiUtil.ACCESS_LEVEL_PUBLIC, ACCESS_LEVEL_PUBLIC, @@ -43,32 +37,27 @@ public final class LombokProcessorUtil { private static final String NULL_DEFAULT = "@@@NULL@@@"; - @Nullable @PsiModifier.ModifierConstant - public static String getMethodModifier(@NotNull PsiAnnotation psiAnnotation) { + public static @Nullable String getMethodModifier(@NotNull PsiAnnotation psiAnnotation) { return getLevelVisibility(psiAnnotation, "value"); } - @Nullable @PsiModifier.ModifierConstant - public static String getAccessVisibility(@NotNull PsiAnnotation psiAnnotation) { + public static @Nullable String getAccessVisibility(@NotNull PsiAnnotation psiAnnotation) { return getLevelVisibility(psiAnnotation, "access"); } - @Nullable @PsiModifier.ModifierConstant - public static String getLevelVisibility(@NotNull PsiAnnotation psiAnnotation) { + public static @Nullable String getLevelVisibility(@NotNull PsiAnnotation psiAnnotation) { return getLevelVisibility(psiAnnotation, "level"); } - @Nullable @PsiModifier.ModifierConstant - private static String getLevelVisibility(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) { + private static @Nullable String getLevelVisibility(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) { return convertAccessLevelToJavaModifier(PsiAnnotationUtil.getEnumAnnotationValue(psiAnnotation, parameter, ACCESS_LEVEL_PUBLIC)); } - @Nullable - public static String getAccessLevel(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) { + public static @Nullable String getAccessLevel(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) { final String annotationValue = PsiAnnotationUtil.getEnumAnnotationValue(psiAnnotation, parameter, NULL_DEFAULT); return NULL_DEFAULT.equals(annotationValue) ? null : VALUE_ACCESS_LEVEL_MAP.get(annotationValue); } @@ -119,9 +108,8 @@ public final class LombokProcessorUtil { return annotationStrings; } - @Nullable @PsiModifier.ModifierConstant - private static String convertAccessLevelToJavaModifier(String value) { + private static @Nullable String convertAccessLevelToJavaModifier(String value) { if (null == value || value.isEmpty()) { return PsiModifier.PUBLIC; } @@ -134,15 +122,13 @@ public final class LombokProcessorUtil { return VALUE_ACCESS_LEVEL_MAP.get(value); } - @NotNull - public static PsiAnnotation createAnnotationWithAccessLevel(@NotNull PsiModifierListOwner psiModifierListOwner, - String annotationClassName) { + public static @NotNull PsiAnnotation createAnnotationWithAccessLevel(@NotNull PsiModifierListOwner psiModifierListOwner, + String annotationClassName) { Optional value = convertModifierToLombokAccessLevel(psiModifierListOwner); return PsiAnnotationUtil.createPsiAnnotation(psiModifierListOwner, value.orElse(""), annotationClassName); } - @NotNull - public static Optional convertModifierToLombokAccessLevel(@NotNull PsiModifierListOwner psiModifierListOwner) { + public static @NotNull Optional convertModifierToLombokAccessLevel(@NotNull PsiModifierListOwner psiModifierListOwner) { final PsiModifierList modifierList = psiModifierListOwner.getModifierList(); if (null != modifierList) { final int accessLevelCode = PsiUtil.getAccessLevel(modifierList); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationSearchUtil.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationSearchUtil.java index 1b758b27755e..99f29f82f7a7 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationSearchUtil.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationSearchUtil.java @@ -13,16 +13,14 @@ import java.util.Set; public final class PsiAnnotationSearchUtil { - @Nullable - public static PsiAnnotation findAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, @NotNull String annotationFQN) { + public static @Nullable PsiAnnotation findAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, @NotNull String annotationFQN) { if (DumbIncompleteModeUtil.isDumbOrIncompleteMode(psiModifierListOwner)) { return DumbIncompleteModeUtil.findAnnotationInDumbOrIncompleteMode(psiModifierListOwner, annotationFQN); } return psiModifierListOwner.getAnnotation(annotationFQN); } - @Nullable - public static PsiAnnotation findAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, String @NotNull ... annotationFQNs) { + public static @Nullable PsiAnnotation findAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, String @NotNull ... annotationFQNs) { boolean isDumbMode = DumbIncompleteModeUtil.isDumbOrIncompleteMode(psiModifierListOwner); for (String annotationFQN : annotationFQNs) { PsiAnnotation annotation; @@ -58,8 +56,7 @@ public final class PsiAnnotationSearchUtil { return !isAnnotatedWith(psiModifierListOwner, annotationTypes); } - @NotNull - public static String getShortNameOf(@NotNull PsiAnnotation psiAnnotation) { + public static @NotNull String getShortNameOf(@NotNull PsiAnnotation psiAnnotation) { PsiJavaCodeReferenceElement referenceElement = psiAnnotation.getNameReferenceElement(); return StringUtil.notNullize(null == referenceElement ? null : referenceElement.getReferenceName()); } @@ -75,9 +72,8 @@ public final class PsiAnnotationSearchUtil { return false; } - @Nullable - public static PsiAnnotation findAnnotationByShortNameOnly(@NotNull PsiModifierListOwner psiModifierListOwner, - String @NotNull ... annotationFQNs) { + public static @Nullable PsiAnnotation findAnnotationByShortNameOnly(@NotNull PsiModifierListOwner psiModifierListOwner, + String @NotNull ... annotationFQNs) { if (annotationFQNs.length > 0) { Collection possibleShortNames = ContainerUtil.map(annotationFQNs, StringUtil::getShortName); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationUtil.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationUtil.java index b01b1de785ae..e6face365530 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationUtil.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiAnnotationUtil.java @@ -20,26 +20,23 @@ import java.util.List; */ public final class PsiAnnotationUtil { - @NotNull - public static PsiAnnotation createPsiAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, String annotationClassName) { + public static @NotNull PsiAnnotation createPsiAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, String annotationClassName) { return createPsiAnnotation(psiModifierListOwner, "", annotationClassName); } - @NotNull - public static PsiAnnotation createPsiAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, - @Nullable String value, - String annotationClassName) { + public static @NotNull PsiAnnotation createPsiAnnotation(@NotNull PsiModifierListOwner psiModifierListOwner, + @Nullable String value, + String annotationClassName) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiModifierListOwner.getProject()); final PsiClass psiClass = PsiTreeUtil.getParentOfType(psiModifierListOwner, PsiClass.class); final String valueString = StringUtil.isNotEmpty(value) ? "(" + value + ")" : ""; return elementFactory.createAnnotationFromText("@" + annotationClassName + valueString, psiClass); } - @NotNull - public static Collection getAnnotationValues(@NotNull PsiAnnotation psiAnnotation, - @NotNull String parameter, - @NotNull Class asClass, - @NotNull List defaultDumbValue) { + public static @NotNull Collection getAnnotationValues(@NotNull PsiAnnotation psiAnnotation, + @NotNull String parameter, + @NotNull Class asClass, + @NotNull List defaultDumbValue) { Collection result = Collections.emptyList(); PsiAnnotationMemberValue attributeValue; if (DumbIncompleteModeUtil.isDumbOrIncompleteMode(psiAnnotation)) { @@ -99,8 +96,7 @@ public final class PsiAnnotationUtil { return result instanceof Number ? ((Number) result).intValue() : defaultValue; } - @Nullable - private static T resolveElementValue(@NotNull PsiElement psiElement, @NotNull Class asClass) { + private static @Nullable T resolveElementValue(@NotNull PsiElement psiElement, @NotNull Class asClass) { T value = null; if (psiElement instanceof PsiReferenceExpression) { final PsiElement resolved = ((PsiReferenceExpression) psiElement).resolve(); @@ -140,8 +136,7 @@ public final class PsiAnnotationUtil { return value; } - @Nullable - public static Boolean getDeclaredBooleanAnnotationValue(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) { + public static @Nullable Boolean getDeclaredBooleanAnnotationValue(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) { PsiAnnotationMemberValue attributeValue = psiAnnotation.findDeclaredAttributeValue(parameter); final JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(psiAnnotation.getProject()); Object constValue = javaPsiFacade.getConstantEvaluationHelper().computeConstantExpression(attributeValue); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiClassUtil.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiClassUtil.java index 57d36acefd8f..ac5c879b2549 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiClassUtil.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiClassUtil.java @@ -23,8 +23,7 @@ public final class PsiClassUtil { * @param psiClass psiClass to collect all of methods from * @return all intern methods of the class */ - @NotNull - public static Collection collectClassMethodsIntern(@NotNull PsiClass psiClass) { + public static @NotNull Collection collectClassMethodsIntern(@NotNull PsiClass psiClass) { if (psiClass instanceof PsiExtensibleClass) { return new ArrayList<>(((PsiExtensibleClass) psiClass).getOwnMethods()); } else { @@ -38,8 +37,7 @@ public final class PsiClassUtil { * @param psiClass psiClass to collect all of fields from * @return all intern fields of the class */ - @NotNull - public static Collection collectClassFieldsIntern(@NotNull PsiClass psiClass) { + public static @NotNull Collection collectClassFieldsIntern(@NotNull PsiClass psiClass) { if (psiClass instanceof PsiExtensibleClass) { return ((PsiExtensibleClass) psiClass).getOwnFields(); } else { @@ -53,8 +51,7 @@ public final class PsiClassUtil { * @param psiClass psiClass to collect all inner classes from * @return all inner classes of the class */ - @NotNull - public static Collection collectInnerClassesIntern(@NotNull PsiClass psiClass) { + public static @NotNull Collection collectInnerClassesIntern(@NotNull PsiClass psiClass) { if (psiClass instanceof PsiExtensibleClass) { return ((PsiExtensibleClass) psiClass).getOwnInnerClasses(); } else { @@ -62,8 +59,7 @@ public final class PsiClassUtil { } } - @NotNull - public static Collection collectClassMemberIntern(@NotNull PsiClass psiClass) { + public static @NotNull Collection collectClassMemberIntern(@NotNull PsiClass psiClass) { return Arrays.stream(psiClass.getChildren()).filter(e -> e instanceof PsiField || e instanceof PsiMethod).map(PsiMember.class::cast).collect(Collectors.toList()); } @@ -71,32 +67,29 @@ public final class PsiClassUtil { return Arrays.stream(psiClass.getChildren()).filter(desiredClass::isInstance).map(desiredClass::cast).collect(Collectors.toList()); } - @NotNull - public static Collection collectClassConstructorIntern(@NotNull PsiClass psiClass) { + public static @NotNull Collection collectClassConstructorIntern(@NotNull PsiClass psiClass) { final Collection psiMethods = collectClassMethodsIntern(psiClass); return ContainerUtil.filter(psiMethods, PsiMethod::isConstructor); } - @NotNull - public static Collection collectClassStaticMethodsIntern(@NotNull PsiClass psiClass) { + public static @NotNull Collection collectClassStaticMethodsIntern(@NotNull PsiClass psiClass) { final Collection psiMethods = collectClassMethodsIntern(psiClass); return ContainerUtil.filter(psiMethods, psiMethod -> psiMethod.hasModifierProperty(PsiModifier.STATIC)); } - public static boolean hasSuperClass(@NotNull final PsiClass psiClass) { + public static boolean hasSuperClass(final @NotNull PsiClass psiClass) { final PsiClass superClass = psiClass.getSuperClass(); return (null != superClass && !CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName()) || !superTypesIsEmptyOrObjectOnly(psiClass)); } - private static boolean superTypesIsEmptyOrObjectOnly(@NotNull final PsiClass psiClass) { + private static boolean superTypesIsEmptyOrObjectOnly(final @NotNull PsiClass psiClass) { // It returns abstract classes, but also Object. final PsiClassType[] superTypes = psiClass.getSuperTypes(); return superTypes.length != 1 || CommonClassNames.JAVA_LANG_OBJECT.equals(superTypes[0].getCanonicalText()); } - @NotNull - public static PsiClassType getWildcardClassType(@NotNull PsiClass psiClass) { + public static @NotNull PsiClassType getWildcardClassType(@NotNull PsiClass psiClass) { final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiClass.getProject()); if (psiClass.hasTypeParameters()) { PsiType[] wildcardTypes = new PsiType[psiClass.getTypeParameters().length]; @@ -109,8 +102,7 @@ public final class PsiClassUtil { /** * Creates a PsiType for a PsiClass enriched with generic substitution information if available */ - @NotNull - public static PsiClassType getTypeWithGenerics(@NotNull PsiClass psiClass) { + public static @NotNull PsiClassType getTypeWithGenerics(@NotNull PsiClass psiClass) { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiClass.getProject()); if (psiClass.hasTypeParameters()) { final PsiType[] psiTypes = Stream.of(psiClass.getTypeParameters()).map(factory::createType).toArray(PsiType[]::new); diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiTypeUtil.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiTypeUtil.java index 0de7b205dffc..c10325a78730 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiTypeUtil.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/util/PsiTypeUtil.java @@ -10,13 +10,11 @@ import org.jetbrains.annotations.Nullable; public final class PsiTypeUtil { - @NotNull - public static PsiType extractOneElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager) { + public static @NotNull PsiType extractOneElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager) { return extractOneElementType(psiType, psiManager, CommonClassNames.JAVA_LANG_ITERABLE, 0); } - @NotNull - public static PsiType extractOneElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager, final String superClass, final int paramIndex) { + public static @NotNull PsiType extractOneElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager, final String superClass, final int paramIndex) { PsiType oneElementType = substituteTypeParameter(psiType, superClass, paramIndex); if (null == oneElementType) { oneElementType = getJavaLangObject(psiManager); @@ -32,13 +30,11 @@ public final class PsiTypeUtil { return oneElementType; } - @NotNull - public static PsiType extractAllElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager) { + public static @NotNull PsiType extractAllElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager) { return extractAllElementType(psiType, psiManager, CommonClassNames.JAVA_LANG_ITERABLE, 0); } - @NotNull - public static PsiType extractAllElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager, final String superClass, final int paramIndex) { + public static @NotNull PsiType extractAllElementType(@NotNull PsiType psiType, @NotNull PsiManager psiManager, final String superClass, final int paramIndex) { PsiType oneElementType = substituteTypeParameter(psiType, superClass, paramIndex); if (null == oneElementType || Comparing.equal(getJavaLangObject(psiManager), oneElementType)) { @@ -48,13 +44,11 @@ public final class PsiTypeUtil { } } - @NotNull - private static PsiClassType getJavaLangObject(@NotNull PsiManager psiManager) { + private static @NotNull PsiClassType getJavaLangObject(@NotNull PsiManager psiManager) { return PsiType.getJavaLangObject(psiManager, GlobalSearchScope.allScope(psiManager.getProject())); } - @NotNull - public static PsiType createCollectionType(@NotNull PsiManager psiManager, final String collectionQualifiedName, PsiType @NotNull... psiTypes) { + public static @NotNull PsiType createCollectionType(@NotNull PsiManager psiManager, final String collectionQualifiedName, PsiType @NotNull... psiTypes) { final Project project = psiManager.getProject(); final GlobalSearchScope globalsearchscope = GlobalSearchScope.allScope(project); final JavaPsiFacade facade = JavaPsiFacade.getInstance(project); @@ -67,8 +61,7 @@ public final class PsiTypeUtil { } } - @Nullable - public static String getQualifiedName(@NotNull PsiType psiType) { + public static @Nullable String getQualifiedName(@NotNull PsiType psiType) { final PsiClass psiFieldClass = PsiUtil.resolveClassInType(psiType); return psiFieldClass != null ? psiFieldClass.getQualifiedName() : null; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/braces/MarkdownQuoteHandler.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/braces/MarkdownQuoteHandler.java index e6434a1d9a2c..10d61b54abb7 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/braces/MarkdownQuoteHandler.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/braces/MarkdownQuoteHandler.java @@ -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 org.intellij.plugins.markdown.braces; import com.intellij.codeInsight.editorActions.QuoteHandler; @@ -25,7 +11,7 @@ import org.intellij.plugins.markdown.lang.MarkdownTokenTypes; import org.jetbrains.annotations.NotNull; public final class MarkdownQuoteHandler implements QuoteHandler { - private final static TokenSet QUOTE_TYPES = TokenSet.create(MarkdownTokenTypes.EMPH, + private static final TokenSet QUOTE_TYPES = TokenSet.create(MarkdownTokenTypes.EMPH, //MarkdownTokenTypes.TILDE, MarkdownTokenTypes.BACKTICK, MarkdownTokenTypes.SINGLE_QUOTE, diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownStripTrailingSpacesFilterFactory.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownStripTrailingSpacesFilterFactory.java index 6ceba957aa8a..ab5b6af82e5d 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownStripTrailingSpacesFilterFactory.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownStripTrailingSpacesFilterFactory.java @@ -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 org.intellij.plugins.markdown.editor; import com.intellij.lang.Language; @@ -27,9 +13,8 @@ import org.jetbrains.annotations.Nullable; public final class MarkdownStripTrailingSpacesFilterFactory extends StripTrailingSpacesFilterFactory { - @NotNull @Override - public StripTrailingSpacesFilter createFilter(@Nullable Project project, @NotNull Document document) { + public @NotNull StripTrailingSpacesFilter createFilter(@Nullable Project project, @NotNull Document document) { Language documentLanguage = PsiBasedStripTrailingSpacesFilter.getDocumentLanguage(document); if (documentLanguage != null && documentLanguage.is(MarkdownLanguage.INSTANCE)) { return StripTrailingSpacesFilter.NOT_ALLOWED; diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownTypedHandler.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownTypedHandler.java index 47f88a07732f..059fdbd5823b 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownTypedHandler.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/editor/MarkdownTypedHandler.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.editor; import com.intellij.codeInsight.AutoPopupController; @@ -11,9 +12,8 @@ import org.intellij.plugins.markdown.lang.psi.impl.MarkdownFile; import org.jetbrains.annotations.NotNull; public final class MarkdownTypedHandler extends TypedHandlerDelegate { - @NotNull @Override - public Result checkAutoPopup(char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { + public @NotNull Result checkAutoPopup(char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (!(file instanceof MarkdownFile)) return Result.CONTINUE; if (charTyped == '`') { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownColorSettingsPage.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownColorSettingsPage.java index 23286c5ac638..dba7d0d0fa1d 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownColorSettingsPage.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownColorSettingsPage.java @@ -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 org.intellij.plugins.markdown.highlighting; import com.intellij.openapi.editor.colors.TextAttributesKey; @@ -26,8 +26,7 @@ public class MarkdownColorSettingsPage implements ColorSettingsPage { private static final AttributesDescriptor[] ATTRIBUTE_DESCRIPTORS = AttributeDescriptorsHolder.INSTANCE.get(); @Override - @NotNull - public Map getAdditionalHighlightingTagToDescriptorMap() { + public @NotNull Map getAdditionalHighlightingTagToDescriptorMap() { final Map result = new HashMap<>(); result.put("hh1", MarkdownHighlighterColors.HEADER_LEVEL_1); @@ -78,9 +77,7 @@ public class MarkdownColorSettingsPage implements ColorSettingsPage { } @Override - @NonNls - @NotNull - public String getDemoText() { + public @NonNls @NotNull String getDemoText() { try (Reader reader = new InputStreamReader(getClass().getResourceAsStream("SampleDocument.md"), StandardCharsets.UTF_8)) { String result = StreamUtil.readText(reader); return StringUtil.convertLineSeparators(result); @@ -91,20 +88,17 @@ public class MarkdownColorSettingsPage implements ColorSettingsPage { } @Override - @NotNull - public String getDisplayName() { + public @NotNull String getDisplayName() { return MarkdownBundle.message("markdown.plugin.name"); } @Override - @NotNull - public SyntaxHighlighter getHighlighter() { + public @NotNull SyntaxHighlighter getHighlighter() { return new MarkdownSyntaxHighlighter(); } @Override - @Nullable - public Icon getIcon() { + public @Nullable Icon getIcon() { return null; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownIndexPatternBuilder.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownIndexPatternBuilder.java index 5fcd1588db18..4c37ec45b1d8 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownIndexPatternBuilder.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownIndexPatternBuilder.java @@ -1,16 +1,4 @@ -// Copyright 2000-2018 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 org.intellij.plugins.markdown.highlighting; import com.intellij.lexer.LayeredLexer; @@ -27,9 +15,8 @@ import org.jetbrains.annotations.Nullable; public final class MarkdownIndexPatternBuilder implements IndexPatternBuilder { public static final TokenSet COMMENT_TOKEN_SET = TokenSet.create(MarkdownElementTypes.COMMENT_VALUE); - @Nullable @Override - public Lexer getIndexingLexer(@NotNull PsiFile file) { + public @Nullable Lexer getIndexingLexer(@NotNull PsiFile file) { if (!(file instanceof MarkdownFile)) { return null; } @@ -43,9 +30,8 @@ public final class MarkdownIndexPatternBuilder implements IndexPatternBuilder { } } - @Nullable @Override - public TokenSet getCommentTokenSet(@NotNull PsiFile file) { + public @Nullable TokenSet getCommentTokenSet(@NotNull PsiFile file) { return file instanceof MarkdownFile ? COMMENT_TOKEN_SET : null; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownSyntaxHighlighter.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownSyntaxHighlighter.java index 82f0733af769..c21822afb159 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownSyntaxHighlighter.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownSyntaxHighlighter.java @@ -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 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 org.intellij.plugins.markdown.highlighting; import com.intellij.lexer.Lexer; @@ -77,8 +77,7 @@ public class MarkdownSyntaxHighlighter extends SyntaxHighlighterBase { } @Override - @NotNull - public Lexer getHighlightingLexer() { + public @NotNull Lexer getHighlightingLexer() { return lexer; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownTodoIndexer.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownTodoIndexer.java index 29453d1a8fab..7564600de6e8 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownTodoIndexer.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/highlighting/MarkdownTodoIndexer.java @@ -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 org.intellij.plugins.markdown.highlighting; import com.intellij.lexer.Lexer; @@ -9,9 +9,8 @@ import com.intellij.psi.search.UsageSearchContext; import org.jetbrains.annotations.NotNull; public class MarkdownTodoIndexer extends LexerBasedTodoIndexer { - @NotNull @Override - public Lexer createLexer(@NotNull OccurrenceConsumer consumer) { + public @NotNull Lexer createLexer(@NotNull OccurrenceConsumer consumer) { return new BaseFilterLexer(new MarkdownHighlightingLexer(), consumer) { @Override public void advance() { diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownElementType.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownElementType.java index daf0aa9751e0..a233c358048e 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownElementType.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownElementType.java @@ -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 org.intellij.plugins.markdown.lang; import com.intellij.psi.tree.IElementType; @@ -28,11 +14,9 @@ import java.util.concurrent.ConcurrentHashMap; public class MarkdownElementType extends IElementType { - @NotNull - private static final Map markdownToPlatformTypeMap = + private static final @NotNull Map markdownToPlatformTypeMap = new ConcurrentHashMap<>(); - @NotNull - private static final Map platformToMarkdownTypeMap = + private static final @NotNull Map platformToMarkdownTypeMap = new ConcurrentHashMap<>(); public MarkdownElementType(@NotNull @NonNls String debugName) { diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownFileType.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownFileType.java index c0fa2495b42c..2d2a8f22eeb5 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownFileType.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/MarkdownFileType.java @@ -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 org.intellij.plugins.markdown.lang; import com.intellij.openapi.fileTypes.LanguageFileType; @@ -11,28 +11,24 @@ import javax.swing.*; public final class MarkdownFileType extends LanguageFileType { public static final MarkdownFileType INSTANCE = new MarkdownFileType(); - @NlsSafe - private static final String MARKDOWN_DESCRIPTION = "Markdown"; + private static final @NlsSafe String MARKDOWN_DESCRIPTION = "Markdown"; private MarkdownFileType() { super(MarkdownLanguage.INSTANCE); } - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "Markdown"; } - @NotNull @Override - public String getDescription() { + public @NotNull String getDescription() { return MARKDOWN_DESCRIPTION; } - @NotNull @Override - public String getDefaultExtension() { + public @NotNull String getDefaultExtension() { return "md"; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownLexerAdapter.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownLexerAdapter.java index f7e58a749866..748053c5f288 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownLexerAdapter.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownLexerAdapter.java @@ -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 org.intellij.plugins.markdown.lang.lexer; import com.intellij.lexer.LexerBase; @@ -24,8 +10,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class MarkdownLexerAdapter extends LexerBase { - @NotNull - private final MarkdownLexer delegateLexer = MarkdownParserManager.FLAVOUR.createInlinesLexer(); + private final @NotNull MarkdownLexer delegateLexer = MarkdownParserManager.FLAVOUR.createInlinesLexer(); private int endOffset; @@ -40,9 +25,8 @@ public class MarkdownLexerAdapter extends LexerBase { return 1; } - @Nullable @Override - public IElementType getTokenType() { + public @Nullable IElementType getTokenType() { return MarkdownElementType.platformType(delegateLexer.getType()); } @@ -61,9 +45,8 @@ public class MarkdownLexerAdapter extends LexerBase { delegateLexer.advance(); } - @NotNull @Override - public CharSequence getBufferSequence() { + public @NotNull CharSequence getBufferSequence() { return delegateLexer.getOriginalText(); } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownToplevelLexer.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownToplevelLexer.java index 2bb6965160bb..08abd4025d5f 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownToplevelLexer.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/lexer/MarkdownToplevelLexer.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.lang.lexer; import com.intellij.lexer.LexerBase; @@ -28,7 +29,7 @@ public class MarkdownToplevelLexer extends LexerBase { private int myLexemeIndex; - private @NotNull final MarkdownFlavourDescriptor flavour; + private final @NotNull MarkdownFlavourDescriptor flavour; public MarkdownToplevelLexer() { this(MarkdownParserManager.FLAVOUR); @@ -62,9 +63,8 @@ public class MarkdownToplevelLexer extends LexerBase { return myLexemeIndex; } - @Nullable @Override - public IElementType getTokenType() { + public @Nullable IElementType getTokenType() { if (myLexemeIndex >= myLexemes.size()) { return null; } @@ -92,9 +92,8 @@ public class MarkdownToplevelLexer extends LexerBase { myLexemeIndex++; } - @NotNull @Override - public CharSequence getBufferSequence() { + public @NotNull CharSequence getBufferSequence() { return myBuffer; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserAdapter.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserAdapter.java index 578d0edea7d7..db921e2954c8 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserAdapter.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserAdapter.java @@ -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 org.intellij.plugins.markdown.lang.parser; import com.intellij.lang.ASTNode; @@ -24,7 +10,7 @@ import org.intellij.markdown.flavours.MarkdownFlavourDescriptor; import org.jetbrains.annotations.NotNull; public class MarkdownParserAdapter implements PsiParser { - @NotNull final MarkdownFlavourDescriptor myFlavour; + final @NotNull MarkdownFlavourDescriptor myFlavour; public MarkdownParserAdapter() { this(MarkdownParserManager.FLAVOUR); @@ -35,8 +21,7 @@ public class MarkdownParserAdapter implements PsiParser { } @Override - @NotNull - public ASTNode parse(@NotNull IElementType root, @NotNull PsiBuilder builder) { + public @NotNull ASTNode parse(@NotNull IElementType root, @NotNull PsiBuilder builder) { final var rootMarker = builder.mark(); rootMarker.setCustomEdgeTokenBinders(WhitespacesBinders.GREEDY_LEFT_BINDER, WhitespacesBinders.GREEDY_RIGHT_BINDER); final var parsedTree = MarkdownParserManager.parseContent(builder.getOriginalText(), myFlavour); diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserDefinition.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserDefinition.java index 85752af4e02a..12d971e9a446 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserDefinition.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/parser/MarkdownParserDefinition.java @@ -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 org.intellij.plugins.markdown.lang.parser; import com.intellij.lang.ASTNode; @@ -22,60 +22,51 @@ import org.jetbrains.annotations.NotNull; public class MarkdownParserDefinition implements ParserDefinition { public static final IFileElementType MARKDOWN_FILE_ELEMENT_TYPE = new MarkdownFileElementType(); - @NotNull @Override - public Lexer createLexer(Project project) { + public @NotNull Lexer createLexer(Project project) { return new MarkdownToplevelLexer(); } - @NotNull @Override - public PsiParser createParser(Project project) { + public @NotNull PsiParser createParser(Project project) { return new MarkdownParserAdapter(); } - @NotNull @Override - public IFileElementType getFileNodeType() { + public @NotNull IFileElementType getFileNodeType() { return MARKDOWN_FILE_ELEMENT_TYPE; } - @NotNull @Override - public TokenSet getWhitespaceTokens() { + public @NotNull TokenSet getWhitespaceTokens() { return MarkdownTokenTypeSets.WHITE_SPACES; } - @NotNull @Override - public TokenSet getCommentTokens() { + public @NotNull TokenSet getCommentTokens() { return TokenSet.EMPTY; } - @NotNull @Override - public TokenSet getStringLiteralElements() { + public @NotNull TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } - @NotNull @Override - public PsiElement createElement(ASTNode node) { + public @NotNull PsiElement createElement(ASTNode node) { final IElementType type = node.getElementType(); return type instanceof MarkdownStubElementType ? ((MarkdownStubElementType)type).createElement(node) : MarkdownPsiFactory.createElement(node); } - @NotNull @Override - public PsiFile createFile(@NotNull FileViewProvider viewProvider) { + public @NotNull PsiFile createFile(@NotNull FileViewProvider viewProvider) { return MarkdownFlavourUtil.createMarkdownFile(viewProvider); } - @NotNull @Override - public SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right) { + public @NotNull SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right) { return SpaceRequirements.MAY; } } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java index 07bec255667b..e4a64fe14825 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java @@ -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 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 org.intellij.plugins.markdown.lang.psi; import com.intellij.openapi.project.Project; @@ -26,8 +26,7 @@ import java.util.function.Function; public final class MarkdownPsiElementFactory { private MarkdownPsiElementFactory() { } - @NotNull - public static MarkdownFile createFile(@NotNull Project project, @NotNull String text) { + public static @NotNull MarkdownFile createFile(@NotNull Project project, @NotNull String text) { final LightVirtualFile virtualFile = new LightVirtualFile("temp.rb", MarkdownLanguage.INSTANCE, text); PsiFile psiFile = ((PsiFileFactoryImpl)PsiFileFactory.getInstance(project)) .trySetupPsiForFile(virtualFile, MarkdownLanguage.INSTANCE, true, true); @@ -40,17 +39,15 @@ public final class MarkdownPsiElementFactory { } - @NotNull - public static MarkdownCodeFence createCodeFence(@NotNull Project project, @Nullable String language, @NotNull String text) { + public static @NotNull MarkdownCodeFence createCodeFence(@NotNull Project project, @Nullable String language, @NotNull String text) { return createCodeFence(project, language, text, null); } - @NotNull - public static MarkdownCodeFence createCodeFence(@NotNull Project project, - @Nullable String language, - @NotNull String text, - @Nullable String indent) { + public static @NotNull MarkdownCodeFence createCodeFence(@NotNull Project project, + @Nullable String language, + @NotNull String text, + @Nullable String indent) { String content = "```" + StringUtil.notNullize(language) + "\n" + text + "\n" + StringUtil.notNullize(indent) + "```"; @@ -60,28 +57,23 @@ public final class MarkdownPsiElementFactory { return (MarkdownCodeFence)file.getFirstChild(); } - @NotNull - public static MarkdownPsiElement createTextElement(@NotNull Project project, @NotNull String text) { + public static @NotNull MarkdownPsiElement createTextElement(@NotNull Project project, @NotNull String text) { return (MarkdownPsiElement)createFile(project, text).getFirstChild(); } - @NotNull - public static MarkdownHeader createSetext(@NotNull Project project, @NotNull String text, @NotNull String symbol, int count) { + public static @NotNull MarkdownHeader createSetext(@NotNull Project project, @NotNull String text, @NotNull String symbol, int count) { return (MarkdownHeader)createFile(project, text + "\n" + StringUtil.repeat(symbol, count)).getFirstChild(); } - @NotNull - public static MarkdownHeader createHeader(@NotNull Project project, @NotNull String text, int level) { + public static @NotNull MarkdownHeader createHeader(@NotNull Project project, @NotNull String text, int level) { return (MarkdownHeader)createFile(project, StringUtil.repeat("#", level) + " " + text).getFirstChild(); } - @NotNull - public static MarkdownHeader createHeader(@NotNull Project project, @NotNull String text) { + public static @NotNull MarkdownHeader createHeader(@NotNull Project project, @NotNull String text) { return (MarkdownHeader)createFile(project, text).getFirstChild(); } - @NotNull - public static PsiElement createNewLine(@NotNull Project project) { + public static @NotNull PsiElement createNewLine(@NotNull Project project) { return createFile(project, "\n").getFirstChild(); } @@ -90,16 +82,14 @@ public final class MarkdownPsiElementFactory { * * @return root element children of which are new lines */ - @NotNull - public static MarkdownFile createNewLines(@NotNull Project project, int num) { + public static @NotNull MarkdownFile createNewLines(@NotNull Project project, int num) { return createFile(project, StringUtil.repeat("\n", num)); } /** * Returns pair of the link reference and its declaration */ - @NotNull - public static Pair createLinkDeclarationAndReference(@NotNull Project project, + public static @NotNull Pair createLinkDeclarationAndReference(@NotNull Project project, @NotNull String url, @NotNull String text, @Nullable String title, @@ -121,8 +111,7 @@ public final class MarkdownPsiElementFactory { } @ApiStatus.Experimental - @NotNull - public static MarkdownTableSeparatorRow createTableSeparatorRow(@NotNull Project project, @NotNull String text) { + public static @NotNull MarkdownTableSeparatorRow createTableSeparatorRow(@NotNull Project project, @NotNull String text) { final var columnsCount = StringUtil.countChars(text, '|') - 1; if (columnsCount < 1) { throw new IllegalArgumentException("Passed separator text should be valid and contain at least one column.\n Text passed: [" + text + "]"); @@ -143,8 +132,7 @@ public final class MarkdownPsiElementFactory { } @ApiStatus.Experimental - @NotNull - public static Pair createTableCell(@NotNull Project project, @NotNull String text) { + public static @NotNull Pair createTableCell(@NotNull Project project, @NotNull String text) { final var content = "|" + text + "|\n|----|"; final var file = createFile(project, content); final var contentElement = file.findElementAt(1); @@ -153,22 +141,19 @@ public final class MarkdownPsiElementFactory { return new Pair<>(cell, separator); } - @NotNull - private static MarkdownTable findTable(@NotNull PsiElement element) { + private static @NotNull MarkdownTable findTable(@NotNull PsiElement element) { return Objects.requireNonNull(PsiTreeUtil.getParentOfType(element, MarkdownTable.class)); } @ApiStatus.Experimental - @NotNull - public static PsiElement createTableSeparator(@NotNull Project project) { + public static @NotNull PsiElement createTableSeparator(@NotNull Project project) { final var content = "| |\n|----|"; final var file = createFile(project, content); return Objects.requireNonNull(file.findElementAt(0)); } @ApiStatus.Experimental - @NotNull - public static MarkdownTableRow createTableRow(@NotNull Project project, @NotNull Collection contents) { + public static @NotNull MarkdownTableRow createTableRow(@NotNull Project project, @NotNull Collection contents) { final var builder = new StringBuilder(); builder.append('|'); //noinspection StringRepeatCanBeUsed @@ -205,8 +190,7 @@ public final class MarkdownPsiElementFactory { } @ApiStatus.Experimental - @NotNull - public static MarkdownTableRow createTableEmptyRow(@NotNull Project project, @NotNull Collection widths) { + public static @NotNull MarkdownTableRow createTableEmptyRow(@NotNull Project project, @NotNull Collection widths) { final var contents = ContainerUtil.map(widths, width -> " ".repeat(width)); return createTableRow(project, contents); } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownCompositePsiElementBase.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownCompositePsiElementBase.java index ab5a0f371a03..9782686e9394 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownCompositePsiElementBase.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownCompositePsiElementBase.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.lang.psi.impl; import com.intellij.extapi.psi.ASTWrapperPsiElement; @@ -19,20 +20,17 @@ public abstract class MarkdownCompositePsiElementBase extends ASTWrapperPsiEleme super(node); } - @NotNull - protected CharSequence getChars() { + protected @NotNull CharSequence getChars() { return getTextRange().subSequence(getContainingFile().getViewProvider().getContents()); } - @NotNull - protected String shrinkTextTo(int length) { + protected @NotNull String shrinkTextTo(int length) { final CharSequence chars = getChars(); return chars.subSequence(0, Math.min(length, chars.length())).toString(); } - @NotNull @Override - public List getCompositeChildren() { + public @NotNull List getCompositeChildren() { return Arrays.asList(findChildrenByClass(MarkdownPsiElement.class)); } @@ -51,18 +49,16 @@ public abstract class MarkdownCompositePsiElementBase extends ASTWrapperPsiEleme @Override public ItemPresentation getPresentation() { return new MarkdownBasePresentation() { - @Nullable @Override - public String getPresentableText() { + public @Nullable String getPresentableText() { if (!isValid()) { return null; } return getPresentableTagName(); } - @Nullable @Override - public String getLocationString() { + public @Nullable String getLocationString() { if (!isValid()) { return null; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownFile.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownFile.java index 60b3718369da..e86f8f011571 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownFile.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownFile.java @@ -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 org.intellij.plugins.markdown.lang.psi.impl; import com.intellij.extapi.psi.PsiFileBase; @@ -52,13 +38,11 @@ public class MarkdownFile extends PsiFileBase implements MarkdownPsiElement { } @Override - @NotNull - public FileType getFileType() { + public @NotNull FileType getFileType() { return MarkdownFileType.INSTANCE; } - @NotNull - public MarkdownFlavourDescriptor getFlavour() { + public @NotNull MarkdownFlavourDescriptor getFlavour() { return flavour; } } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownHtmlBlock.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownHtmlBlock.java index 084abdc74d58..9e84aa230d6a 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownHtmlBlock.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownHtmlBlock.java @@ -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 org.intellij.plugins.markdown.lang.psi.impl; import com.intellij.extapi.psi.ASTWrapperPsiElement; @@ -18,9 +18,8 @@ public class MarkdownHtmlBlock extends ASTWrapperPsiElement implements MarkdownP @Override public ItemPresentation getPresentation() { return new MarkdownBasePresentation() { - @Nullable @Override - public String getPresentableText() { + public @Nullable String getPresentableText() { return "HTML block"; } }; diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownListItem.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownListItem.java index c254436c2dcd..f14a98d1a636 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownListItem.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/impl/MarkdownListItem.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.lang.psi.impl; import com.intellij.execution.process.ConsoleHighlighter; @@ -22,8 +23,7 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { super(node); } - @Nullable - public PsiElement getMarkerElement() { + public @Nullable PsiElement getMarkerElement() { final PsiElement child = getFirstChild(); if (child != null && MarkdownTokenTypeSets.LIST_MARKERS.contains(child.getNode().getElementType())) { return child; @@ -33,8 +33,7 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { } } - @Nullable - public PsiElement getCheckBox() { + public @Nullable PsiElement getCheckBox() { final PsiElement markerElement = getMarkerElement(); if (markerElement == null) { return null; @@ -48,8 +47,7 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { } } - @Nullable - private PsiElement getFirstNonMarkerElement() { + private @Nullable PsiElement getFirstNonMarkerElement() { final var marker = getMarkerElement(); if (marker == null) { return null; @@ -61,8 +59,7 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { return next; } - @Nullable - public String getItemText() { + public @Nullable String getItemText() { var element = getFirstNonMarkerElement(); if (element == null) { return null; @@ -86,9 +83,8 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { } private class MyItemPresentation extends MarkdownBasePresentation implements ColoredItemPresentation { - @Nullable @Override - public String getPresentableText() { + public @Nullable String getPresentableText() { if (!isValid()) { return null; } @@ -99,9 +95,8 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { return markerElement.getText().trim(); } - @Nullable @Override - public String getLocationString() { + public @Nullable String getLocationString() { if (!isValid()) { return null; } @@ -116,15 +111,13 @@ public class MarkdownListItem extends MarkdownCompositePsiElementBase { } } - @Nullable @Override - public Icon getIcon(boolean unused) { + public @Nullable Icon getIcon(boolean unused) { return null; } - @Nullable @Override - public TextAttributesKey getTextAttributesKey() { + public @Nullable TextAttributesKey getTextAttributesKey() { final PsiElement checkBox = getCheckBox(); if (checkBox == null) { return null; diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/MarkdownStubElementType.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/MarkdownStubElementType.java index 7557925daf62..56bfab58c9fa 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/MarkdownStubElementType.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/MarkdownStubElementType.java @@ -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 org.intellij.plugins.markdown.lang.stubs; import com.intellij.lang.ASTNode; @@ -19,12 +19,10 @@ public abstract class MarkdownStubElementType, return "markdown: " + super.toString(); } - @NotNull - public abstract PsiElement createElement(@NotNull final ASTNode node); + public abstract @NotNull PsiElement createElement(final @NotNull ASTNode node); - @NotNull @Override - public String getExternalId() { + public @NotNull String getExternalId() { return "markdown." + super.toString(); } } \ No newline at end of file diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/impl/MarkdownHeaderStubElementType.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/impl/MarkdownHeaderStubElementType.java index b33f7157d8f4..d0dad25fcabc 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/impl/MarkdownHeaderStubElementType.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/stubs/impl/MarkdownHeaderStubElementType.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.lang.stubs.impl; import com.intellij.lang.ASTNode; @@ -23,9 +24,8 @@ public class MarkdownHeaderStubElementType extends MarkdownStubElementType imp private static final ItemPresentation DUMMY_PRESENTATION = new MarkdownBasePresentation() { - @Nullable @Override - public String getPresentableText() { + public @Nullable String getPresentableText() { return null; } }; @@ -54,9 +53,8 @@ public class MarkdownStructureElement extends PsiTreeElementBase imp } } - @NotNull @Override - public String getAlphaSortKey() { + public @NotNull String getAlphaSortKey() { return StringUtil.notNullize(getElement() instanceof NavigationItem ? ((NavigationItem)getElement()).getName() : null); } @@ -66,9 +64,8 @@ public class MarkdownStructureElement extends PsiTreeElementBase imp return true; } - @Nullable @Override - public String getPresentableText() { + public @Nullable String getPresentableText() { final PsiElement tag = getElement(); if (tag == null) { return StructureViewBundle.message("node.structureview.invalid"); @@ -81,9 +78,8 @@ public class MarkdownStructureElement extends PsiTreeElementBase imp return getPresentation().getLocationString(); } - @NotNull @Override - public ItemPresentation getPresentation() { + public @NotNull ItemPresentation getPresentation() { if (getElement() instanceof PsiFileImpl) { ItemPresentation filePresent = ((PsiFileImpl)getElement()).getPresentation(); return filePresent != null ? filePresent : DUMMY_PRESENTATION; @@ -100,23 +96,20 @@ public class MarkdownStructureElement extends PsiTreeElementBase imp } - @NotNull @Override - public Collection getChildrenBase() { + public @NotNull Collection getChildrenBase() { final ArrayList elements = new ArrayList<>(); MarkdownPsiStructureUtil.processContainer(getElement(), element -> elements.add(new MarkdownStructureElement(element))); return elements; } - @NotNull @Override - public String getLocationPrefix() { + public @NotNull String getLocationPrefix() { return " "; } - @NotNull @Override - public String getLocationSuffix() { + public @NotNull String getLocationSuffix() { return ""; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/structureView/MarkdownStructureViewFactory.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/structureView/MarkdownStructureViewFactory.java index 6658fa561ad1..0a16143da7a1 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/structureView/MarkdownStructureViewFactory.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/structureView/MarkdownStructureViewFactory.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.structureView; import com.intellij.ide.structureView.*; @@ -15,13 +16,11 @@ import static org.intellij.plugins.markdown.util.MarkdownPsiStructureUtil.PRESEN import static org.intellij.plugins.markdown.util.MarkdownPsiStructureUtil.TRANSPARENT_CONTAINERS; public final class MarkdownStructureViewFactory implements PsiStructureViewFactory { - @Nullable @Override - public StructureViewBuilder getStructureViewBuilder(@NotNull final PsiFile psiFile) { + public @Nullable StructureViewBuilder getStructureViewBuilder(final @NotNull PsiFile psiFile) { return new TreeBasedStructureViewBuilder() { - @NotNull @Override - public StructureViewModel createStructureViewModel(@Nullable Editor editor) { + public @NotNull StructureViewModel createStructureViewModel(@Nullable Editor editor) { return new MarkdownStructureViewModel(psiFile, editor); } @@ -37,9 +36,8 @@ public final class MarkdownStructureViewFactory implements PsiStructureViewFacto super(psiFile, editor, new MarkdownStructureElement(psiFile)); } - @Nullable @Override - protected Object findAcceptableElement(PsiElement element) { + protected @Nullable Object findAcceptableElement(PsiElement element) { // walk up the psi-tree until we find an element from the structure view while (element != null && !(element instanceof PsiFile) && !PRESENTABLE_TYPES.contains(PsiUtilCore.getElementType(element))) { IElementType parentType = PsiUtilCore.getElementType(element.getParent()); diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderDownAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderDownAction.java index ab1ceaa1320c..def8abfc4103 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderDownAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderDownAction.java @@ -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 org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.psi.PsiFile; @@ -8,9 +8,8 @@ import org.intellij.plugins.markdown.lang.psi.impl.MarkdownHeader; import org.jetbrains.annotations.NotNull; public class HeaderDownAction extends MarkdownHeaderAction { - @NotNull @Override - protected Function getLevelFunction() { + protected @NotNull Function getLevelFunction() { return integer -> integer + 1; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderUpAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderUpAction.java index 41cc4ee850a1..ba905d35cf77 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderUpAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/HeaderUpAction.java @@ -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 org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.psi.PsiFile; @@ -8,9 +8,8 @@ import org.intellij.plugins.markdown.lang.psi.impl.MarkdownHeader; import org.jetbrains.annotations.NotNull; public class HeaderUpAction extends MarkdownHeaderAction { - @NotNull @Override - protected Function getLevelFunction() { + protected @NotNull Function getLevelFunction() { return integer -> integer - 1; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownHeaderAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownHeaderAction.java index 77325f0eee90..7693c5a082e0 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownHeaderAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownHeaderAction.java @@ -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 org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.openapi.actionSystem.ActionUpdateThread; @@ -37,8 +37,7 @@ public abstract class MarkdownHeaderAction extends AnAction implements DumbAware /** * Returns function that increases or decreases level by 1 */ - @NotNull - protected abstract Function getLevelFunction(); + protected abstract @NotNull Function getLevelFunction(); protected abstract boolean isEnabledForCaret(@NotNull PsiFile psiFile, int selectionStart, int selectionEnd); @@ -94,8 +93,7 @@ public abstract class MarkdownHeaderAction extends AnAction implements DumbAware }, psiFile); } - @Nullable - protected static PsiElement findParent(@NotNull PsiFile psiFile, int selectionStart, int selectionEnd) { + protected static @Nullable PsiElement findParent(@NotNull PsiFile psiFile, int selectionStart, int selectionEnd) { final var elements = MarkdownActionUtil.getElementsUnderCaretOrSelection(psiFile, selectionStart, selectionEnd); PsiElement first = elements.getFirst(); PsiElement second = elements.getSecond(); @@ -139,15 +137,13 @@ public abstract class MarkdownHeaderAction extends AnAction implements DumbAware return Math.min(Math.max(level, 0), 6); } - @NotNull - public MarkdownPsiElement createHeaderForText(@NotNull PsiElement textElement) { + public @NotNull MarkdownPsiElement createHeaderForText(@NotNull PsiElement textElement) { int level = sanitizeHeaderLevel(getLevelFunction().fun(0)); return MarkdownPsiElementFactory.createHeader(textElement.getProject(), textElement.getText(), level); } - @NotNull - public MarkdownPsiElement createNewLevelHeader(@NotNull MarkdownHeader header) { + public @NotNull MarkdownPsiElement createNewLevelHeader(@NotNull MarkdownHeader header) { int level = sanitizeHeaderLevel(getLevelFunction().fun(Objects.requireNonNull(header).getLevel())); MarkdownPsiElement newElement; diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownIntroduceLinkReferenceAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownIntroduceLinkReferenceAction.java index 849743f54e2a..572f5b370ec6 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownIntroduceLinkReferenceAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/MarkdownIntroduceLinkReferenceAction.java @@ -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 org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.codeInsight.daemon.impl.quickfix.EmptyExpression; @@ -142,8 +142,7 @@ public class MarkdownIntroduceLinkReferenceAction extends AnAction implements Du }); } - @Nullable - private static Pair getFileAndEditor(@NotNull AnActionEvent e) { + private static @Nullable Pair getFileAndEditor(@NotNull AnActionEvent e) { final Editor editor = MarkdownActionUtil.findMarkdownEditor(e); final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE); if (editor == null || psiFile == null || !psiFile.isValid()) { @@ -171,8 +170,7 @@ public class MarkdownIntroduceLinkReferenceAction extends AnAction implements Du }); } - @NotNull - public static Pair createLinkDeclarationAndReference(Project project, PsiElement link, String referenceText) { + public static @NotNull Pair createLinkDeclarationAndReference(Project project, PsiElement link, String referenceText) { String text = null; String title = null; String url = getUrl(link); @@ -203,8 +201,7 @@ public class MarkdownIntroduceLinkReferenceAction extends AnAction implements Du return MarkdownPsiElementFactory.createLinkDeclarationAndReference(project, url, text, title, referenceText); } - @Nullable - public static String getUrl(@NotNull PsiElement link) { + public static @Nullable String getUrl(@NotNull PsiElement link) { String url = null; IElementType type = PsiUtilCore.getElementType(link); if (type == AUTOLINK) { @@ -293,8 +290,8 @@ public class MarkdownIntroduceLinkReferenceAction extends AnAction implements Du } @SuppressWarnings("Duplicates") - private static void highlightInEditor(@NotNull final Project project, - @NotNull final Editor editor, + private static void highlightInEditor(final @NotNull Project project, + final @NotNull Editor editor, @NotNull Map highlighterMap, @NotNull PsiElement element) { final List highlighters = new ArrayList<>(); @@ -308,10 +305,10 @@ public class MarkdownIntroduceLinkReferenceAction extends AnAction implements Du } private static final class DuplicatesFinder extends TemplateEditingAdapter { - @NotNull private final String myUrl; - @NotNull private final PsiFile myFile; - @NotNull private final Editor myEditor; - @Nullable private final String myTitleText; + private final @NotNull String myUrl; + private final @NotNull PsiFile myFile; + private final @NotNull Editor myEditor; + private final @Nullable String myTitleText; private DuplicatesFinder(@NotNull PsiFile file, @NotNull Editor editor, @NotNull String url, String titleText) { myUrl = url; diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleBoldAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleBoldAction.java index add1a3e811c8..a806b0ba1599 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleBoldAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleBoldAction.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.psi.tree.IElementType; @@ -7,15 +8,13 @@ import org.jetbrains.annotations.Nullable; public class ToggleBoldAction extends BaseToggleStateAction { - @NotNull @Override - protected String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { + protected @NotNull String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { return "**"; } - @Nullable @Override - protected String getExistingBoundString(@NotNull CharSequence text, int startOffset) { + protected @Nullable String getExistingBoundString(@NotNull CharSequence text, int startOffset) { return text.subSequence(startOffset, startOffset + 2).toString(); } @@ -24,9 +23,8 @@ public class ToggleBoldAction extends BaseToggleStateAction { return true; } - @NotNull @Override - protected IElementType getTargetNodeType() { + protected @NotNull IElementType getTargetNodeType() { return MarkdownElementTypes.STRONG; } } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleCodeSpanAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleCodeSpanAction.java index 71490a014273..afc6790ec804 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleCodeSpanAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleCodeSpanAction.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.openapi.util.text.StringUtil; @@ -8,9 +9,8 @@ import org.jetbrains.annotations.Nullable; public class ToggleCodeSpanAction extends BaseToggleStateAction { - @NotNull @Override - protected String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { + protected @NotNull String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { int maxBacktickSequenceSeen = 0; int curBacktickSequence = 0; for (int i = selectionStart; i < selectionEnd; ++i) { @@ -26,9 +26,8 @@ public class ToggleCodeSpanAction extends BaseToggleStateAction { return StringUtil.repeat("`", maxBacktickSequenceSeen + 1); } - @Nullable @Override - protected String getExistingBoundString(@NotNull CharSequence text, int startOffset) { + protected @Nullable String getExistingBoundString(@NotNull CharSequence text, int startOffset) { int to = startOffset; while (to < text.length() && text.charAt(to) == '`') { to++; @@ -42,9 +41,8 @@ public class ToggleCodeSpanAction extends BaseToggleStateAction { return false; } - @NotNull @Override - protected IElementType getTargetNodeType() { + protected @NotNull IElementType getTargetNodeType() { return MarkdownElementTypes.CODE_SPAN; } } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleItalicAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleItalicAction.java index a8779d38053e..07d9e4c10277 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleItalicAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleItalicAction.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.psi.tree.IElementType; @@ -7,8 +8,7 @@ import org.jetbrains.annotations.NotNull; public class ToggleItalicAction extends BaseToggleStateAction { @Override - @NotNull - protected String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { + protected @NotNull String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { return isWord(text, selectionStart, selectionEnd) ? "_" : "*"; } @@ -18,8 +18,7 @@ public class ToggleItalicAction extends BaseToggleStateAction { } @Override - @NotNull - protected IElementType getTargetNodeType() { + protected @NotNull IElementType getTargetNodeType() { return MarkdownElementTypes.EMPH; } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleStrikethroughAction.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleStrikethroughAction.java index ed5a4bf42918..fb3127384fd3 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleStrikethroughAction.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/actions/styling/ToggleStrikethroughAction.java @@ -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 org.intellij.plugins.markdown.ui.actions.styling; import com.intellij.psi.tree.IElementType; @@ -8,15 +8,13 @@ import org.jetbrains.annotations.Nullable; public class ToggleStrikethroughAction extends BaseToggleStateAction { - @NotNull @Override - protected String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { + protected @NotNull String getBoundString(@NotNull CharSequence text, int selectionStart, int selectionEnd) { return "~~"; } - @Nullable @Override - protected String getExistingBoundString(@NotNull CharSequence text, int startOffset) { + protected @Nullable String getExistingBoundString(@NotNull CharSequence text, int startOffset) { return text.subSequence(startOffset, startOffset + 2).toString(); } @@ -25,9 +23,8 @@ public class ToggleStrikethroughAction extends BaseToggleStateAction { return true; } - @NotNull @Override - protected IElementType getTargetNodeType() { + protected @NotNull IElementType getTargetNodeType() { return MarkdownElementTypes.STRIKETHROUGH; } } diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/html/MarkdownCodeFenceHtmlCache.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/html/MarkdownCodeFenceHtmlCache.java index e0ad444e2645..f295eca77b2e 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/html/MarkdownCodeFenceHtmlCache.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/html/MarkdownCodeFenceHtmlCache.java @@ -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 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 org.intellij.plugins.markdown.ui.preview.html; import com.intellij.concurrency.ConcurrentCollectionFactory; @@ -28,12 +28,12 @@ import java.util.List; import java.util.stream.Collectors; public final class MarkdownCodeFenceHtmlCache implements Disposable { - @NotNull public static final String MARKDOWN_FILE_PATH_KEY = "markdown-md5-file-path"; + public static final @NotNull String MARKDOWN_FILE_PATH_KEY = "markdown-md5-file-path"; - @NotNull private final Alarm myAlarm = new Alarm(this); - @NotNull private final Collection myCodeFencePluginCaches = + private final @NotNull Alarm myAlarm = new Alarm(this); + private final @NotNull Collection myCodeFencePluginCaches = ConcurrentCollectionFactory.createConcurrentSet(); - @NotNull private final Collection myAdditionalCacheToDelete = ConcurrentCollectionFactory.createConcurrentSet(); + private final @NotNull Collection myAdditionalCacheToDelete = ConcurrentCollectionFactory.createConcurrentSet(); public static MarkdownCodeFenceHtmlCache getInstance() { return ApplicationManager.getApplication().getService(MarkdownCodeFenceHtmlCache.class); diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/jcef/JCEFHtmlPanelProvider.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/jcef/JCEFHtmlPanelProvider.java index f7e4f1cb8fa9..a1e5e21dc0bc 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/jcef/JCEFHtmlPanelProvider.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/ui/preview/jcef/JCEFHtmlPanelProvider.java @@ -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 org.intellij.plugins.markdown.ui.preview.jcef; import com.intellij.idea.AppMode; @@ -12,9 +12,8 @@ import org.jetbrains.annotations.NotNull; public final class JCEFHtmlPanelProvider extends MarkdownHtmlPanelProvider { - @NotNull @Override - public MarkdownHtmlPanel createHtmlPanel() { + public @NotNull MarkdownHtmlPanel createHtmlPanel() { return new MarkdownJCEFHtmlPanel(); } @@ -26,15 +25,13 @@ public final class JCEFHtmlPanelProvider extends MarkdownHtmlPanelProvider { return new MarkdownJCEFHtmlPanel(project, virtualFile); } - @NotNull @Override - public AvailabilityInfo isAvailable() { + public @NotNull AvailabilityInfo isAvailable() { return canBeUsed() ? AvailabilityInfo.AVAILABLE : AvailabilityInfo.UNAVAILABLE; } - @NotNull @Override - public ProviderInfo getProviderInfo() { + public @NotNull ProviderInfo getProviderInfo() { return new ProviderInfo("JCEF Browser", JCEFHtmlPanelProvider.class.getName()); } diff --git a/plugins/markdown/fenceInjection/src/main/java/org/intellij/plugins/markdown/fenceInjection/CodeFenceTemporaryLangInjector.java b/plugins/markdown/fenceInjection/src/main/java/org/intellij/plugins/markdown/fenceInjection/CodeFenceTemporaryLangInjector.java index 69d652c54f24..64386879481a 100644 --- a/plugins/markdown/fenceInjection/src/main/java/org/intellij/plugins/markdown/fenceInjection/CodeFenceTemporaryLangInjector.java +++ b/plugins/markdown/fenceInjection/src/main/java/org/intellij/plugins/markdown/fenceInjection/CodeFenceTemporaryLangInjector.java @@ -10,9 +10,8 @@ import org.jetbrains.annotations.Nullable; @ApiStatus.Internal public class CodeFenceTemporaryLangInjector extends CodeFenceInjector { - @Nullable @Override - protected Language findLangForInjection(@NotNull MarkdownCodeFence element) { + protected @Nullable Language findLangForInjection(@NotNull MarkdownCodeFence element) { final TemporaryPlacesRegistry registry = TemporaryPlacesRegistry.getInstance(element.getProject()); final InjectedLanguage language = registry.getLanguageFor(element, element.getContainingFile()); if (language != null) { diff --git a/plugins/markdown/spellchecker/src/main/kotlin/org/intellij/plugins/markdown/spellchecker/MarkdownSpellcheckingStrategy.java b/plugins/markdown/spellchecker/src/main/kotlin/org/intellij/plugins/markdown/spellchecker/MarkdownSpellcheckingStrategy.java index 4dac8bfac173..ca01af53dd12 100644 --- a/plugins/markdown/spellchecker/src/main/kotlin/org/intellij/plugins/markdown/spellchecker/MarkdownSpellcheckingStrategy.java +++ b/plugins/markdown/spellchecker/src/main/kotlin/org/intellij/plugins/markdown/spellchecker/MarkdownSpellcheckingStrategy.java @@ -17,9 +17,8 @@ final class MarkdownSpellcheckingStrategy extends SpellcheckingStrategy implemen MarkdownElementTypes.CODE_SPAN, MarkdownElementTypes.LINK_DESTINATION); - @NotNull @Override - public Tokenizer getTokenizer(PsiElement element) { + public @NotNull Tokenizer getTokenizer(PsiElement element) { final ASTNode node = element.getNode(); if (node == null || node.getElementType() != MarkdownTokenTypes.TEXT) { return SpellcheckingStrategy.EMPTY_TOKENIZER; diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifact.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifact.java index fdcc20667ac1..fc362ae25058 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifact.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifact.java @@ -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 org.jetbrains.idea.maven.model; @@ -99,8 +85,7 @@ public class MavenArtifact implements Serializable, MavenCoordinate { return myBaseVersion; } - @NotNull - public MavenId getMavenId() { + public @NotNull MavenId getMavenId() { return new MavenId(myGroupId, myArtifactId, myVersion); } @@ -173,8 +158,7 @@ public class MavenArtifact implements Serializable, MavenCoordinate { return myResolved; } - @NotNull - public File getFile() { + public @NotNull File getFile() { return myFile; } @@ -222,8 +206,7 @@ public class MavenArtifact implements Serializable, MavenCoordinate { return result.toString(); } - @Nullable - public String getFullClassifier(@Nullable String extraClassifier) { + public @Nullable String getFullClassifier(@Nullable String extraClassifier) { if (StringUtilRt.isEmptyOrSpaces(extraClassifier)) { return myClassifier; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifactNode.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifactNode.java index 6f9108ccac96..8164e354fdc0 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifactNode.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenArtifactNode.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.Nullable; @@ -37,8 +37,7 @@ public class MavenArtifactNode implements Serializable { myPremanagedScope = premanagedScope; } - @Nullable - public MavenArtifactNode getParent() { + public @Nullable MavenArtifactNode getParent() { return myParent; } @@ -51,23 +50,19 @@ public class MavenArtifactNode implements Serializable { return myState; } - @Nullable - public MavenArtifact getRelatedArtifact() { + public @Nullable MavenArtifact getRelatedArtifact() { return myRelatedArtifact; } - @Nullable - public String getOriginalScope() { + public @Nullable String getOriginalScope() { return myOriginalScope; } - @Nullable - public String getPremanagedVersion() { + public @Nullable String getPremanagedVersion() { return myPremanagedVersion; } - @Nullable - public String getPremanagedScope() { + public @Nullable String getPremanagedScope() { return myPremanagedScope; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenPlugin.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenPlugin.java index 7a31df441713..b501372fc995 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenPlugin.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenPlugin.java @@ -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 org.jetbrains.idea.maven.model; @@ -71,8 +71,7 @@ public final class MavenPlugin implements Serializable { return myExtensions; } - @Nullable - public Element getConfigurationElement() { + public @Nullable Element getConfigurationElement() { return myConfiguration; } @@ -84,8 +83,7 @@ public final class MavenPlugin implements Serializable { return myDependencies; } - @Nullable - public Element getGoalConfiguration(@NotNull String goal) { + public @Nullable Element getGoalConfiguration(@NotNull String goal) { for (MavenPlugin.Execution each : getExecutions()) { if (each.getGoals().contains(goal)) { return each.getConfigurationElement(); @@ -218,8 +216,7 @@ public final class MavenPlugin implements Serializable { return myGoals; } - @Nullable - public Element getConfigurationElement() { + public @Nullable Element getConfigurationElement() { return myConfiguration; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProfile.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProfile.java index 09f64b410af9..2e9d8c5f57d4 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProfile.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProfile.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.NotNull; @@ -30,8 +16,7 @@ public class MavenProfile extends MavenModelBase implements Serializable { mySource = source; } - @NotNull - public String getId() { + public @NotNull String getId() { return myId; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProjectProblem.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProjectProblem.java index 7b9ba58c4be4..4f34b61155df 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProjectProblem.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenProjectProblem.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.Nullable; @@ -33,8 +19,7 @@ public class MavenProjectProblem implements Serializable { private final String myDescription; private final ProblemType myType; private final Exception st; - @Nullable - private final MavenArtifact myMavenArtifact; + private final @Nullable MavenArtifact myMavenArtifact; public static MavenProjectProblem createStructureProblem(String path, String description, boolean isError) { return createProblem(path, description, ProblemType.STRUCTURE, isError); @@ -98,8 +83,7 @@ public class MavenProjectProblem implements Serializable { return myType; } - @Nullable - public MavenArtifact getMavenArtifact() { + public @Nullable MavenArtifact getMavenArtifact() { return myMavenArtifact; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenRemoteRepository.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenRemoteRepository.java index ed2007d352dd..2accf3c048c6 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenRemoteRepository.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenRemoteRepository.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.NotNull; @@ -42,33 +28,27 @@ public final class MavenRemoteRepository implements Serializable { mySnapshotsPolicy = snapshotsPolicy; } - @NotNull - public String getId() { + public @NotNull String getId() { return myId; } - @Nullable - public String getName() { + public @Nullable String getName() { return myName; } - @NotNull - public String getUrl() { + public @NotNull String getUrl() { return myUrl; } - @Nullable - public String getLayout() { + public @Nullable String getLayout() { return myLayout; } - @Nullable - public Policy getReleasesPolicy() { + public @Nullable Policy getReleasesPolicy() { return myReleasesPolicy; } - @Nullable - public Policy getSnapshotsPolicy() { + public @Nullable Policy getSnapshotsPolicy() { return mySnapshotsPolicy; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenResource.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenResource.java index 29b5bad0cefb..7cd7704f5a62 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenResource.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenResource.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.NotNull; @@ -24,8 +10,7 @@ import java.util.List; import java.util.Objects; public class MavenResource implements Serializable { - @NotNull - private final String myDirectory; + private final @NotNull String myDirectory; private final boolean myFiltered; private final String myTargetPath; private final List myIncludes; @@ -39,8 +24,7 @@ public class MavenResource implements Serializable { myExcludes = excludes == null ? Collections.emptyList() : new ArrayList(excludes); } - @NotNull - public String getDirectory() { + public @NotNull String getDirectory() { return myDirectory; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMap.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMap.java index 9ea619fdbd84..f9ffef00d720 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMap.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMap.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.NotNull; @@ -33,8 +33,7 @@ public class MavenWorkspaceMap implements Serializable { return myAdditionalContext.get(id); } - @NotNull - public Set getAvailableContextIds() { + public @NotNull Set getAvailableContextIds() { return myAdditionalContext.keySet(); } @@ -44,13 +43,11 @@ public class MavenWorkspaceMap implements Serializable { } } - @Nullable - public Data findFileAndOriginalId(@NotNull MavenId dependencyId) { + public @Nullable Data findFileAndOriginalId(@NotNull MavenId dependencyId) { return myMapping.get(dependencyId); } - @NotNull - public Set getAvailableIds() { + public @NotNull Set getAvailableIds() { return myMapping.keySet(); } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMapWrapper.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMapWrapper.java index 651031336d4a..8edc66b35782 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMapWrapper.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/model/MavenWorkspaceMapWrapper.java @@ -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 org.jetbrains.idea.maven.model; import org.jetbrains.annotations.NotNull; @@ -27,8 +27,7 @@ public class MavenWorkspaceMapWrapper { return myWorkspaceMap.findFileAndOriginalId(mavenId); } - @NotNull - public Set getAvailableIdsForArtifactId(String artifactId) { + public @NotNull Set getAvailableIdsForArtifactId(String artifactId) { Set ids = myArtifactToIdToMavenIdMapping.get(artifactId); return null == ids ? Collections.emptySet() : ids; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactEvent.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactEvent.java index 088592f4727b..4404c3b8b71d 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactEvent.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactEvent.java @@ -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 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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ public class MavenArtifactEvent implements Serializable { } private final MavenServerConsoleIndicator.ResolveType myResolveType; - @NotNull private final ArtifactEventType myArtifactEventType; + private final @NotNull ArtifactEventType myArtifactEventType; private final String myDependencyId; private final String myErrorMessage; private final String myStackTrace; @@ -35,8 +35,7 @@ public class MavenArtifactEvent implements Serializable { return myResolveType; } - @NotNull - public ArtifactEventType getArtifactEventType() { + public @NotNull ArtifactEventType getArtifactEventType() { return myArtifactEventType; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolutionRequest.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolutionRequest.java index ae0e920ad646..5fd6cf0f3071 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolutionRequest.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolutionRequest.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -10,10 +10,8 @@ import java.util.List; import java.util.Objects; public final class MavenArtifactResolutionRequest implements Serializable { - @NotNull - private final MavenArtifactInfo myArtifactInfo; - @NotNull - private final List myRemoteRepositories; + private final @NotNull MavenArtifactInfo myArtifactInfo; + private final @NotNull List myRemoteRepositories; private boolean myUpdateSnapshots; public MavenArtifactResolutionRequest(@NotNull MavenArtifactInfo mavenArtifactInfo, @@ -29,13 +27,11 @@ public final class MavenArtifactResolutionRequest implements Serializable { this(mavenArtifactInfo, repositories, false); } - @NotNull - public MavenArtifactInfo getArtifactInfo() { + public @NotNull MavenArtifactInfo getArtifactInfo() { return myArtifactInfo; } - @NotNull - public List getRemoteRepositories() { + public @NotNull List getRemoteRepositories() { return myRemoteRepositories; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolveResult.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolveResult.java index 936579ed65b1..8e6d97b945d3 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolveResult.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenArtifactResolveResult.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -25,8 +11,8 @@ import java.util.ArrayList; import java.util.List; public class MavenArtifactResolveResult implements Serializable { - @NotNull public final List mavenResolvedArtifacts; - @Nullable public final MavenProjectProblem problem; + public final @NotNull List mavenResolvedArtifacts; + public final @Nullable MavenProjectProblem problem; public MavenArtifactResolveResult(@NotNull List artifacts, @Nullable MavenProjectProblem problem) { this.mavenResolvedArtifacts = new ArrayList<>(artifacts); diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenCoreInitializationException.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenCoreInitializationException.java index 48199be72dcf..49af165233e7 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenCoreInitializationException.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenCoreInitializationException.java @@ -1,25 +1,21 @@ -// 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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.model.MavenId; -import java.io.File; - public class MavenCoreInitializationException extends RuntimeException { - @Nullable - private final MavenId myUnresolvedExtensionId; + private final @Nullable MavenId myUnresolvedExtensionId; public MavenCoreInitializationException(@NotNull Throwable cause, @Nullable MavenId id) { super(cause); myUnresolvedExtensionId = id; } - @Nullable - public MavenId getUnresolvedExtensionId() { + public @Nullable MavenId getUnresolvedExtensionId() { return myUnresolvedExtensionId; } } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderSettings.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderSettings.java index 3080350425f0..dfcd40c03b04 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderSettings.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenEmbedderSettings.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -25,10 +11,8 @@ import java.io.Serializable; */ public class MavenEmbedderSettings implements Serializable { private static final String DEFAULT_RESOLVER = "org.jetbrains.idea.maven.server.embedder.CustomMaven36ArtifactResolver"; - @NotNull - private final MavenServerSettings settings; - @Nullable - private final String multiModuleProjectDirectory; + private final @NotNull MavenServerSettings settings; + private final @Nullable String multiModuleProjectDirectory; private final boolean forceResolveDependenciesSequentially; private final boolean useCustomDependenciesResolver; @@ -46,13 +30,11 @@ public class MavenEmbedderSettings implements Serializable { this.useCustomDependenciesResolver = useCustomDependenciesResolver; } - @NotNull - public MavenServerSettings getSettings() { + public @NotNull MavenServerSettings getSettings() { return settings; } - @Nullable - public String getMultiModuleProjectDirectory() { + public @Nullable String getMultiModuleProjectDirectory() { return multiModuleProjectDirectory; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionRequest.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionRequest.java index f20228157976..43c752f4819a 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionRequest.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionRequest.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -12,10 +12,10 @@ import java.util.Objects; import java.util.Properties; public final class MavenGoalExecutionRequest implements Serializable { - @NotNull private final File file; - @NotNull private final MavenExplicitProfiles profiles; + private final @NotNull File file; + private final @NotNull MavenExplicitProfiles profiles; private final List selectedProjects; - @NotNull private final Properties userProperties; + private final @NotNull Properties userProperties; public MavenGoalExecutionRequest(@NotNull File file, @NotNull MavenExplicitProfiles profiles) { this(file, profiles, Collections.emptyList(), new Properties()); diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionResult.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionResult.java index ccbe26f7988f..5993066d529e 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionResult.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenGoalExecutionResult.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -14,9 +14,9 @@ import java.util.List; public class MavenGoalExecutionResult implements Serializable { public final boolean success; - @NotNull public final File file; - @NotNull public final Folders folders; - @NotNull public final Collection problems; + public final @NotNull File file; + public final @NotNull Folders folders; + public final @NotNull Collection problems; public MavenGoalExecutionResult(boolean success, @NotNull File file, @NotNull Folders folders, @NotNull Collection problems) { this.success = success; diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenRemotePullUtil.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenRemotePullUtil.java index d8ae604299df..dfc4374210ae 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenRemotePullUtil.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenRemotePullUtil.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -8,8 +8,7 @@ import java.util.List; import java.util.Queue; public final class MavenRemotePullUtil { - @NotNull - static List pull(Queue queue) { + static @NotNull List pull(Queue queue) { List result = new ArrayList(); T last = queue.poll(); if(last == null) return result; diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerConsoleIndicatorImpl.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerConsoleIndicatorImpl.java index f74b803819e7..5771ffd3ca5c 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerConsoleIndicatorImpl.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerConsoleIndicatorImpl.java @@ -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 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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -49,15 +49,13 @@ public class MavenServerConsoleIndicatorImpl implements MavenServerConsoleIndica myCancelled = true; } - @NotNull @Override - public List pullDownloadEvents() { + public @NotNull List pullDownloadEvents() { return MavenRemotePullUtil.pull(myPullingQueue); } - @NotNull @Override - public List pullConsoleEvents() { + public @NotNull List pullConsoleEvents() { return MavenRemotePullUtil.pull(myConsoleEventsQueue); } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerDownloadListenerWrapper.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerDownloadListenerWrapper.java index a05b3a9485db..909e2e04ec13 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerDownloadListenerWrapper.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerDownloadListenerWrapper.java @@ -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 org.jetbrains.idea.maven.server; @@ -18,8 +18,7 @@ public class MavenServerDownloadListenerWrapper extends MavenRemoteObject } @Override - @NotNull - public List pull() { + public @NotNull List pull() { return MavenRemotePullUtil.pull(myPullingQueue); } } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerEmbeddedBase.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerEmbeddedBase.java index 4223ebc24f2c..b5ac1cdc312a 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerEmbeddedBase.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerEmbeddedBase.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -13,9 +13,8 @@ import java.util.concurrent.atomic.AtomicInteger; public abstract class MavenServerEmbeddedBase extends MavenRemoteObject implements MavenServerEmbedder { private final Map myLongRunningTasks = new ConcurrentHashMap<>(); - @NotNull @Override - public LongRunningTaskStatus getLongRunningTaskStatus(@NotNull String longRunningTaskId, MavenToken token) { + public @NotNull LongRunningTaskStatus getLongRunningTaskStatus(@NotNull String longRunningTaskId, MavenToken token) { MavenServerUtil.checkToken(token); LongRunningTaskImpl task = myLongRunningTasks.get(longRunningTaskId); @@ -42,22 +41,21 @@ public abstract class MavenServerEmbeddedBase extends MavenRemoteObject implemen return true; } - @NotNull - protected LongRunningTask newLongRunningTask(@NotNull String id, - int totalRequests, - @NotNull MavenServerConsoleIndicatorWrapper indicatorWrapper) { + protected @NotNull LongRunningTask newLongRunningTask(@NotNull String id, + int totalRequests, + @NotNull MavenServerConsoleIndicatorWrapper indicatorWrapper) { return new LongRunningTaskImpl(id, totalRequests, indicatorWrapper); } protected class LongRunningTaskImpl implements LongRunningTask { - @NotNull private final String myId; + private final @NotNull String myId; private final AtomicInteger myFinishedRequests = new AtomicInteger(0); private final AtomicInteger myTotalRequests; private final AtomicBoolean isCanceled = new AtomicBoolean(false); - @NotNull private final MavenServerConsoleIndicatorImpl myIndicator; + private final @NotNull MavenServerConsoleIndicatorImpl myIndicator; - @NotNull private final MavenServerConsoleIndicatorWrapper myIndicatorWrapper; + private final @NotNull MavenServerConsoleIndicatorWrapper myIndicatorWrapper; public LongRunningTaskImpl(@NotNull String id, int totalRequests, @NotNull MavenServerConsoleIndicatorWrapper indicatorWrapper) { myId = id; diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerExecutionResult.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerExecutionResult.java index 78ebdb06c05f..b5028cc6aeba 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerExecutionResult.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerExecutionResult.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -30,11 +16,11 @@ public class MavenServerExecutionResult implements Serializable { public static final MavenServerExecutionResult EMPTY = new MavenServerExecutionResult(null, null, Collections.emptyList(), Collections.emptySet()); - @Nullable public final File file; - @Nullable public final ProjectData projectData; - @NotNull public final Collection problems; - @NotNull public final Set unresolvedArtifacts; - @NotNull public final Collection unresolvedProblems; + public final @Nullable File file; + public final @Nullable ProjectData projectData; + public final @NotNull Collection problems; + public final @NotNull Set unresolvedArtifacts; + public final @NotNull Collection unresolvedProblems; public MavenServerExecutionResult(@Nullable File file, @Nullable ProjectData projectData, @@ -56,10 +42,8 @@ public class MavenServerExecutionResult implements Serializable { } public static class ProjectData implements Serializable { - @NotNull - public final MavenModel mavenModel; - @NotNull - public final List managedDependencies; + public final @NotNull MavenModel mavenModel; + public final @NotNull List managedDependencies; public final String dependencyHash; public final boolean dependencyResolutionSkipped; public final Map mavenModelMap; diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerLoggerWrapper.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerLoggerWrapper.java index 77041a37fe6b..483eff02e51d 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerLoggerWrapper.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerLoggerWrapper.java @@ -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 org.jetbrains.idea.maven.server; import com.intellij.util.ExceptionUtilRt; @@ -48,9 +48,8 @@ MavenServerLoggerWrapper extends MavenRemoteObject implements MavenPullServerLog myPullingQueue.add(new ServerLogEvent(ServerLogEvent.Type.DEBUG, o)); } - @NotNull @Override - public List pull() { + public @NotNull List pull() { return MavenRemotePullUtil.pull(myPullingQueue); } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerResponse.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerResponse.java index b7d58c28c388..b33b930191e3 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerResponse.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerResponse.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -6,21 +6,19 @@ import org.jetbrains.annotations.NotNull; import java.io.Serializable; public class MavenServerResponse implements Serializable { - @NotNull private final T result; - @NotNull private final LongRunningTaskStatus status; + private final @NotNull T result; + private final @NotNull LongRunningTaskStatus status; public MavenServerResponse(@NotNull T result, @NotNull LongRunningTaskStatus status) { this.result = result; this.status = status; } - @NotNull - public T getResult() { + public @NotNull T getResult() { return result; } - @NotNull - public LongRunningTaskStatus getStatus() { + public @NotNull LongRunningTaskStatus getStatus() { return status; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerSettings.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerSettings.java index 8243fb607e73..5bfb7b78586c 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerSettings.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerSettings.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -26,19 +12,18 @@ public class MavenServerSettings implements Serializable, Cloneable { * do not use debug level {@link MavenServerConsoleIndicator#LEVEL_DEBUG} by default, it can pollute logs */ private int myLoggingLevel = MavenServerConsoleIndicator.LEVEL_INFO; - @Nullable private String myMavenHome; - @Nullable private String myUserSettingsFile; - @Nullable private String myGlobalSettingsFile; - @Nullable private String myLocalRepository; - @NotNull private Properties myUserProperties = new Properties(); + private @Nullable String myMavenHome; + private @Nullable String myUserSettingsFile; + private @Nullable String myGlobalSettingsFile; + private @Nullable String myLocalRepository; + private @NotNull Properties myUserProperties = new Properties(); private boolean updateSnapshots; private boolean isOffline; private String projectJdk; - @Nullable - public String getProjectJdk() { + public @Nullable String getProjectJdk() { return projectJdk; } @@ -54,8 +39,7 @@ public class MavenServerSettings implements Serializable, Cloneable { myLoggingLevel = loggingLevel; } - @NotNull - public Properties getUserProperties() { + public @NotNull Properties getUserProperties() { return myUserProperties; } @@ -63,8 +47,7 @@ public class MavenServerSettings implements Serializable, Cloneable { myUserProperties = properties; } - @Nullable - public String getMavenHomePath() { + public @Nullable String getMavenHomePath() { return myMavenHome; } @@ -72,8 +55,7 @@ public class MavenServerSettings implements Serializable, Cloneable { myMavenHome = mavenHome; } - @Nullable - public String getUserSettingsPath() { + public @Nullable String getUserSettingsPath() { return myUserSettingsFile; } @@ -81,8 +63,7 @@ public class MavenServerSettings implements Serializable, Cloneable { myUserSettingsFile = userSettingsFile; } - @Nullable - public String getGlobalSettingsPath() { + public @Nullable String getGlobalSettingsPath() { return myGlobalSettingsFile; } @@ -90,8 +71,7 @@ public class MavenServerSettings implements Serializable, Cloneable { myGlobalSettingsFile = globalSettingsFile; } - @Nullable - public String getLocalRepositoryPath() { + public @Nullable String getLocalRepositoryPath() { return myLocalRepository; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerUtil.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerUtil.java index 8fa51bfc7f4b..73875a58d5ed 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerUtil.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/MavenServerUtil.java @@ -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 org.jetbrains.idea.maven.server; import com.intellij.openapi.util.SystemInfoRt; @@ -48,8 +48,7 @@ public final class MavenServerUtil { return mySystemPropertiesCache; } - @NotNull - public static File findMavenBasedir(@NotNull File workingDir) { + public static @NotNull File findMavenBasedir(@NotNull File workingDir) { File baseDir = workingDir; File dir = workingDir; while ((dir = dir.getParentFile()) != null) { diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionRequest.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionRequest.java index f51dfa3481b9..847455d36b00 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionRequest.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionRequest.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -27,8 +27,7 @@ public class PluginResolutionRequest implements Serializable { this.pluginDependencies = new ArrayList<>(pluginDependencies); } - @NotNull - public MavenId getMavenPluginId() { + public @NotNull MavenId getMavenPluginId() { return myMavenPluginId; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionResponse.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionResponse.java index cbfa266d4e78..426f5d0ba4e6 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionResponse.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PluginResolutionResponse.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -23,8 +23,7 @@ public class PluginResolutionResponse implements Serializable { myDependencyArtifacts = dependencyArtifacts; } - @NotNull - public MavenId getMavenPluginId() { + public @NotNull MavenId getMavenPluginId() { return myMavenPluginId; } @@ -36,8 +35,7 @@ public class PluginResolutionResponse implements Serializable { return myPluginArtifact != null; } - @NotNull - public List getPluginDependencyArtifacts() { + public @NotNull List getPluginDependencyArtifacts() { return myDependencyArtifacts; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PomHashMap.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PomHashMap.java index 8cd278c8a4e5..89ff129c7768 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PomHashMap.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/PomHashMap.java @@ -9,11 +9,9 @@ import java.io.Serializable; import java.util.*; public class PomHashMap implements Serializable { - @NotNull - private final Map<@NotNull File, @NotNull PomHashValue> pomMap = new HashMap<>(); + private final @NotNull Map<@NotNull File, @NotNull PomHashValue> pomMap = new HashMap<>(); - @NotNull - private final Map<@NotNull File, @NotNull HashSet<@NotNull File>> pomDependencies = new HashMap<>(); + private final @NotNull Map<@NotNull File, @NotNull HashSet<@NotNull File>> pomDependencies = new HashMap<>(); public void put(@NotNull File pom, @Nullable String dependencyHash) { pomMap.put(pom, new PomHashValue(dependencyHash)); @@ -30,19 +28,16 @@ public class PomHashMap implements Serializable { } } - @NotNull - public Set<@NotNull File> getFileDependencies(@NotNull File pom) { + public @NotNull Set<@NotNull File> getFileDependencies(@NotNull File pom) { Set<@NotNull File> dependencies = pomDependencies.get(pom); return dependencies == null ? Collections.emptySet() : dependencies; } - @NotNull - public Set<@NotNull File> keySet() { + public @NotNull Set<@NotNull File> keySet() { return pomMap.keySet(); } - @Nullable - public String getDependencyHash(@NotNull File file) { + public @Nullable String getDependencyHash(@NotNull File file) { PomHashValue data = pomMap.get(file); return null == data ? null : data.getDependencyHash(); } @@ -62,15 +57,13 @@ public class PomHashMap implements Serializable { } class PomHashValue implements Serializable { - @Nullable - private final String dependencyHash; + private final @Nullable String dependencyHash; PomHashValue(@Nullable String dependencyHash) { this.dependencyHash = dependencyHash; } - @Nullable - public String getDependencyHash() { + public @Nullable String getDependencyHash() { return dependencyHash; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ProjectResolutionRequest.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ProjectResolutionRequest.java index 2f83bd19e609..9434cbca010b 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ProjectResolutionRequest.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ProjectResolutionRequest.java @@ -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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -33,23 +33,19 @@ public class ProjectResolutionRequest implements Serializable { this.userProperties = userProperties; } - @NotNull - public PomHashMap getPomHashMap() { + public @NotNull PomHashMap getPomHashMap() { return pomHashMap; } - @NotNull - public List getActiveProfiles() { + public @NotNull List getActiveProfiles() { return activeProfiles; } - @NotNull - public List getInactiveProfiles() { + public @NotNull List getInactiveProfiles() { return inactiveProfiles; } - @Nullable - public MavenWorkspaceMap getWorkspaceMap() { + public @Nullable MavenWorkspaceMap getWorkspaceMap() { return workspaceMap; } diff --git a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ServerLogEvent.java b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ServerLogEvent.java index 537894bd1a3e..e7f5fbf0af6c 100644 --- a/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ServerLogEvent.java +++ b/plugins/maven-server-api/src/main/java/org/jetbrains/idea/maven/server/ServerLogEvent.java @@ -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 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 org.jetbrains.idea.maven.server; import org.jetbrains.annotations.NotNull; @@ -19,12 +19,10 @@ public class ServerLogEvent implements Serializable { DEBUG } - @NotNull - private final Type myType; + private final @NotNull Type myType; private final String myString; - @NotNull - public Type getType() { + public @NotNull Type getType() { return myType; } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/CommandsRunner.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/CommandsRunner.java index 164aa9e6a939..51647ef80c50 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/CommandsRunner.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/CommandsRunner.java @@ -13,7 +13,7 @@ public final class CommandsRunner { private CompletableFuture actionCallback; - synchronized static CommandsRunner getInstance() { + static synchronized CommandsRunner getInstance() { if (myCommandsRunner == null) { myCommandsRunner = new CommandsRunner(); } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTestSpan.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTestSpan.java index 83eba3267315..8929d0e102ea 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTestSpan.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTestSpan.java @@ -8,9 +8,9 @@ import io.opentelemetry.context.Scope; public final class PerformanceTestSpan { public static final String SPAN_NAME = "performance_test"; - public final static IJTracer TRACER = TelemetryManager.getInstance().getTracer( + public static final IJTracer TRACER = TelemetryManager.getInstance().getTracer( new com.intellij.platform.diagnostic.telemetry.Scope("performance-plugin", null)); - public final static IJTracer WARMUP_TRACER = new WarmupIJTracer(TRACER); + public static final IJTracer WARMUP_TRACER = new WarmupIJTracer(TRACER); private static Span performanceTestSpan; private static Scope performanceScope; diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTroubleInfoCollector.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTroubleInfoCollector.java index 1ffc47080128..3b444b58607f 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTroubleInfoCollector.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PerformanceTroubleInfoCollector.java @@ -6,9 +6,8 @@ import com.jetbrains.performancePlugin.utils.StatisticCollector; import org.jetbrains.annotations.NotNull; public class PerformanceTroubleInfoCollector implements TroubleInfoCollector { - @NotNull @Override - public String collectInfo(@NotNull Project project) { + public @NotNull String collectInfo(@NotNull Project project) { return "=====PERFORMANCE SUMMARY=====\n" + new StatisticCollector(project).collectMetrics(false); } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PlaybackRunnerExtended.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PlaybackRunnerExtended.java index 4529df3f4f05..4e9aa87812c1 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PlaybackRunnerExtended.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/PlaybackRunnerExtended.java @@ -47,8 +47,7 @@ public final class PlaybackRunnerExtended extends PlaybackRunner { } @Override - @Nullable - public Project getProject() { + public @Nullable Project getProject() { return myProject; } @@ -58,9 +57,8 @@ public final class PlaybackRunnerExtended extends PlaybackRunner { myStopped = true; } - @Nullable @Override - protected PlaybackCommand createCommand(@NotNull String _command, int line, @NotNull File scriptDir) { + protected @Nullable PlaybackCommand createCommand(@NotNull String _command, int line, @NotNull File scriptDir) { String command = _command.replaceAll("[\r\n]+$", ""); String[] cmdline = command.split("\\s+"); PlaybackCommand playbackCommand = null; diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ProjectIndexingComponent.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ProjectIndexingComponent.java index 5468078c2b27..9456a3beefc4 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ProjectIndexingComponent.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ProjectIndexingComponent.java @@ -17,7 +17,7 @@ import java.util.ArrayList; public final class ProjectIndexingComponent implements DumbService.DumbModeListener { public static final String PROFILE_INDEXING_COMPONENT = "performancePlugin.isProfileIndexing"; public static final String PROFILE_WITH_ASYNC = "performancePlugin.isProfileIndexingWithAsync"; - @NotNull private final Project project; + private final @NotNull Project project; private static final int TIMEOUT = 500; private final Alarm alarm; diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/CompletionCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/CompletionCommand.java index 58691b604e76..923444fa94b9 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/CompletionCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/CompletionCommand.java @@ -147,8 +147,7 @@ public class CompletionCommand extends PerformanceCommand { return Promises.toPromise(actionCallback); } - @Nullable - public static Path getCompletionItemsDir() { + public static @Nullable Path getCompletionItemsDir() { String property = System.getProperty(DUMP_COMPLETION_ITEMS_DIR); if (property != null) { return Paths.get(property); @@ -164,8 +163,7 @@ public class CompletionCommand extends PerformanceCommand { DataDumper.dump(report, file.toPath()); } - @NotNull - private String createTestReportFilename() { + private @NotNull String createTestReportFilename() { return "completion-" + getCompletionType() + "-" + System.currentTimeMillis() + (isWarmupMode() ? "_warmup" : "") + ".txt"; } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ExpandMenuCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ExpandMenuCommand.java index 8b281ae5c410..e835c5ebb4d9 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ExpandMenuCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ExpandMenuCommand.java @@ -20,7 +20,7 @@ import java.awt.*; import java.util.List; -abstract public class ExpandMenuCommand extends AbstractCallbackBasedCommand { +public abstract class ExpandMenuCommand extends AbstractCallbackBasedCommand { public ExpandMenuCommand(@NotNull String text, int line) { super(text, line, true); } @@ -47,11 +47,9 @@ abstract public class ExpandMenuCommand extends AbstractCallbackBasedCommand { callback.setDone(); } - abstract protected String getSpanName(); + protected abstract String getSpanName(); - @NotNull - abstract protected String getGroupId(); + protected abstract @NotNull String getGroupId(); - @NotNull - abstract protected String getPlace(); + protected abstract @NotNull String getPlace(); } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/FindUsagesDumper.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/FindUsagesDumper.java index 18de84b839e7..c741ed7395ce 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/FindUsagesDumper.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/FindUsagesDumper.java @@ -44,8 +44,7 @@ public final class FindUsagesDumper { DataDumper.dump(foundUsagesReport, jsonPath); } - @NotNull - public static FoundUsage convertToFoundUsage(@NotNull Project project, @NotNull Usage usage) { + public static @NotNull FoundUsage convertToFoundUsage(@NotNull Project project, @NotNull Usage usage) { PortableFilePath portableFilePath = null; Integer line = null; if (usage instanceof UsageInfo2UsageAdapter adapter) { @@ -59,8 +58,7 @@ public final class FindUsagesDumper { return new FoundUsage(text, portableFilePath, line); } - @Nullable - public static Path getFoundUsagesJsonPath() { + public static @Nullable Path getFoundUsagesJsonPath() { String property = System.getProperty(DUMP_FOUND_USAGES_DESTINATION_FILE); if (property != null) { return Paths.get(property); @@ -68,8 +66,7 @@ public final class FindUsagesDumper { return null; } - @NotNull - public static FoundUsagesReport parseFoundUsagesReportFromFile(@NotNull Path reportPath) throws IOException { + public static @NotNull FoundUsagesReport parseFoundUsagesReportFromFile(@NotNull Path reportPath) throws IOException { return DataDumper.objectMapper.readValue(reportPath.toFile(), FoundUsagesReport.class); } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommand.java index a5849cfbb978..87bed8f550a0 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommand.java @@ -37,9 +37,8 @@ public class InspectionCommand extends AbstractCommand { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull final PlaybackContext context) { + protected @NotNull Promise _execute(final @NotNull PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); String extension = extractCommandArgument(PREFIX); @@ -69,8 +68,7 @@ public class InspectionCommand extends AbstractCommand { return Promises.toPromise(actionCallback); } - @Nullable - public static AnalysisScope getAnalysisScope(String extension, @NotNull Project project) { + public static @Nullable AnalysisScope getAnalysisScope(String extension, @NotNull Project project) { AnalysisScope scope; if (extension.isEmpty()) { scope = new AnalysisScope(project); @@ -85,8 +83,7 @@ public class InspectionCommand extends AbstractCommand { return scope; } - @NotNull - private static Collection getFiles(@NotNull final String extension, @NotNull Project project) { + private static @NotNull Collection getFiles(final @NotNull String extension, @NotNull Project project) { final Collection files = new HashSet<>(100); FileIndex index = ProjectRootManager.getInstance(project).getFileIndex(); index.iterateContent(fileOrDir -> { diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommandEx.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommandEx.java index 9a98f811b7eb..f34f7fa32a4c 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommandEx.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/InspectionCommandEx.java @@ -77,9 +77,8 @@ public class InspectionCommandEx extends AbstractCommand { } } - @NotNull @Override - protected Promise _execute(@NotNull final PlaybackContext context) { + protected @NotNull Promise _execute(final @NotNull PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); if (StringUtil.isNotEmpty(myOptions.downloadFileUrl)) { @@ -270,10 +269,9 @@ public class InspectionCommandEx extends AbstractCommand { } } - @NotNull - private static String buildIdentifier(@NotNull final String inspectionResultFilename, - final String @Nullable [] inspectionTrueFields, - @NotNull Project project) { + private static @NotNull String buildIdentifier(final @NotNull String inspectionResultFilename, + final String @Nullable [] inspectionTrueFields, + @NotNull Project project) { return Stream.of(project.getName(), StringUtil.trimExtensions(inspectionResultFilename), @@ -291,13 +289,9 @@ public class InspectionCommandEx extends AbstractCommand { } public static class Options { - @Nullable - @Argument - public String scopeName; + @Argument public @Nullable String scopeName; - @Nullable - @Argument - public String toolShortName; + @Argument public @Nullable String toolShortName; @Argument public String @Nullable [] inspectionTrueFields; @@ -305,13 +299,9 @@ public class InspectionCommandEx extends AbstractCommand { @Argument public String @Nullable [] inspectionFalseFields; - @Nullable - @Argument - public String downloadFileUrl; + @Argument public @Nullable String downloadFileUrl; - @Nullable - @Argument - public String directory; + @Argument public @Nullable String directory; @Argument public boolean hideResults = false; diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/MemoryDumpCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/MemoryDumpCommand.java index 1ca1366d090f..b009dd4cda20 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/MemoryDumpCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/MemoryDumpCommand.java @@ -44,8 +44,7 @@ public final class MemoryDumpCommand extends AbstractCommand { } } - @NotNull - public static String getMemoryDumpPath() { + public static @NotNull String getMemoryDumpPath() { String memoryDumpPath = System.getProperties().getProperty("memory.snapshots.path", PathManager.getLogPath()); String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); return memoryDumpPath + File.separator + (Timer.instance.getActivityName() + '-' + currentTime + ".hprof"); diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ReformatCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ReformatCommand.java index 082bfedef668..4fd80d92d9a0 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ReformatCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ReformatCommand.java @@ -21,9 +21,8 @@ public class ReformatCommand extends AbstractCommand { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull PlaybackContext context) { + protected @NotNull Promise _execute(@NotNull PlaybackContext context) { ActionCallback myActionCallback = new ActionCallbackProfilerStopper(); ReformatCodeProcessor codeProcessor = new ReformatCodeProcessor(context.getProject(), false); codeProcessor.setPostRunnable(() -> { diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/RunConfigurationCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/RunConfigurationCommand.java index ec244f3a9788..df514c178d5d 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/RunConfigurationCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/RunConfigurationCommand.java @@ -52,9 +52,8 @@ public final class RunConfigurationCommand extends AbstractCommand { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull final PlaybackContext context) { + protected @NotNull Promise _execute(final @NotNull PlaybackContext context) { //example: %runConfiguration -mode=TILL_TERMINATED|-configurationName=My Run Configuration|-failureExpected|-debug RunConfigurationOptions options = new RunConfigurationOptions(); Args.parse(options, Arrays.stream(extractCommandArgument(PREFIX).split("\\|")) diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SearchEverywhereCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SearchEverywhereCommand.java index 1599af8891e7..3797b0d2d362 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SearchEverywhereCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SearchEverywhereCommand.java @@ -39,8 +39,8 @@ import java.util.concurrent.Future; import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadPoolExecutor; -import static com.intellij.openapi.ui.playback.commands.ActionCommand.getInputEvent; import static com.intellij.ide.actions.searcheverywhere.statistics.SearchFieldStatisticsCollector.wrapDataContextWithActionStartData; +import static com.intellij.openapi.ui.playback.commands.ActionCommand.getInputEvent; import static com.intellij.openapi.ui.playback.commands.AlphaNumericTypeCommand.findTarget; /** @@ -144,8 +144,7 @@ public class SearchEverywhereCommand extends AbstractCommand { return Promises.toPromise(actionCallback); } - @NotNull - private static Ref computeTabId(String tab) { + private static @NotNull Ref computeTabId(String tab) { Ref tabId = new Ref<>(); switch (tab) { case "text" -> tabId.set(TextSearchContributor.class.getSimpleName()); diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SetupProjectSdkCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SetupProjectSdkCommand.java index c55c1a5836b7..f846167bff0b 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SetupProjectSdkCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SetupProjectSdkCommand.java @@ -73,8 +73,7 @@ public class SetupProjectSdkCommand extends AbstractCommand { } } - @NotNull - private Sdk setupOrDetectSdk(@NotNull Consumer logMessage) { + private @NotNull Sdk setupOrDetectSdk(@NotNull Consumer logMessage) { Sdk oldSdk = ProjectJdkTable.getInstance().findJdk(mySdkName); if (oldSdk != null) { if (Objects.equals(oldSdk.getSdkType().getName(), mySdkName) && FileUtil.pathsEqual(oldSdk.getHomePath(), mySdkHome)) { diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ShowAltEnter.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ShowAltEnter.java index 21b4430f2d76..2699f416b839 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ShowAltEnter.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/ShowAltEnter.java @@ -42,9 +42,8 @@ public final class ShowAltEnter extends AbstractCommand implements Disposable { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull PlaybackContext context) { + protected @NotNull Promise _execute(@NotNull PlaybackContext context) { ActionCallback actionCallback = new ActionCallbackProfilerStopper(); String extractCommandList = extractCommandArgument(PREFIX); String[] commandList = extractCommandList.split("\\|"); diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SingleInspectionCommand.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SingleInspectionCommand.java index ccf98207fcee..f44ed18a9bd3 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SingleInspectionCommand.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/SingleInspectionCommand.java @@ -41,9 +41,8 @@ public class SingleInspectionCommand extends AbstractCommand { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull final PlaybackContext context) { + protected @NotNull Promise _execute(final @NotNull PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); final String[] commandArguments = extractCommandArgument(PREFIX).split("\\s+", 2); String shortInspectionName = commandArguments[0]; diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StartPowerSave.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StartPowerSave.java index b48c0bd2e4b5..170808ae65fb 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StartPowerSave.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StartPowerSave.java @@ -2,7 +2,6 @@ package com.jetbrains.performancePlugin.commands; import com.intellij.ide.PowerSaveMode; import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.ui.playback.PlaybackContext; import com.intellij.openapi.ui.playback.commands.AbstractCommand; @@ -21,9 +20,8 @@ public class StartPowerSave extends AbstractCommand implements Disposable { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull PlaybackContext context) { + protected @NotNull Promise _execute(@NotNull PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); final MessageBusConnection busConnection = context.getProject().getMessageBus().connect(); busConnection.subscribe(PowerSaveMode.TOPIC, () -> actionCallback.setDone()); diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StopPowerSave.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StopPowerSave.java index f8b33fa23979..d891de8a9c56 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StopPowerSave.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/StopPowerSave.java @@ -20,9 +20,8 @@ public class StopPowerSave extends AbstractCommand implements Disposable { super(text, line); } - @NotNull @Override - protected Promise _execute(@NotNull PlaybackContext context) { + protected @NotNull Promise _execute(@NotNull PlaybackContext context) { final ActionCallback actionCallback = new ActionCallbackProfilerStopper(); final MessageBusConnection busConnection = context.getProject().getMessageBus().connect(); busConnection.subscribe(PowerSaveMode.TOPIC, () -> actionCallback.setDone()); diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/profilers/SnapshotOpener.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/profilers/SnapshotOpener.java index e222a72b2d77..fa6ed177f4a8 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/profilers/SnapshotOpener.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/profilers/SnapshotOpener.java @@ -12,8 +12,7 @@ import java.io.File; public interface SnapshotOpener { ExtensionPointName EP_NAME = new ExtensionPointName<>("com.jetbrains.performancePlugin.snapshotOpener"); - @Nullable - static SnapshotOpener findSnapshotOpener(@NotNull File snapshot, @Nullable Project project) { + static @Nullable SnapshotOpener findSnapshotOpener(@NotNull File snapshot, @Nullable Project project) { return ContainerUtil.find(EP_NAME.getExtensionList(), p -> p.canOpen(snapshot, project)); } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ui/FinishScriptDialog.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ui/FinishScriptDialog.java index 48ff3b956316..75eef9187303 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ui/FinishScriptDialog.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/ui/FinishScriptDialog.java @@ -76,9 +76,8 @@ public class FinishScriptDialog extends DialogWrapper { return dialogActions.toArray(new Action[0]); } - @Nullable @Override - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myMainPanel; } } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ActionCallbackProfilerStopper.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ActionCallbackProfilerStopper.java index 4c4f93f3955d..fa5e3940e500 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ActionCallbackProfilerStopper.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ActionCallbackProfilerStopper.java @@ -28,8 +28,7 @@ public final class ActionCallbackProfilerStopper extends ActionCallback { Notifications.Bus.notify(errorNotification); } - @NlsSafe - private String errorText() { + private @NlsSafe String errorText() { return Strings.notNullize(getError()); } } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/HardwareCollector.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/HardwareCollector.java index 7fbddc87b21b..199394dc5bd2 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/HardwareCollector.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/HardwareCollector.java @@ -41,7 +41,7 @@ import java.util.List; import java.util.Map; public final class HardwareCollector implements TroubleInfoCollector { - private final static Logger logger = Logger.getInstance(HardwareCollector.class); + private static final Logger logger = Logger.getInstance(HardwareCollector.class); private final List info = new ArrayList<>(); diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ReporterWithTimer.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ReporterWithTimer.java index 08b3e8ad1ba3..2e79ff97ecf7 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ReporterWithTimer.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ReporterWithTimer.java @@ -46,8 +46,7 @@ public class ReporterWithTimer implements PlaybackCommandReporter { }); } - @NotNull - private static Notification getDelayNotification(long totalTime, long averageDelay, long maxDelay) { + private static @NotNull Notification getDelayNotification(long totalTime, long averageDelay, long maxDelay) { return new Notification(PlaybackRunnerExtended.NOTIFICATION_GROUP, PerformanceTestingBundle.message("delay.notification.title"), PerformanceTestingBundle.message("delay.notification.message", totalTime, averageDelay, maxDelay), diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/SafeSpanStack.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/SafeSpanStack.java index a940652f4919..e07f15e2fe4a 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/SafeSpanStack.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/SafeSpanStack.java @@ -2,9 +2,9 @@ package com.jetbrains.performancePlugin.utils; -import com.intellij.platform.diagnostic.telemetry.IJTracer; import com.intellij.openapi.Disposable; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.platform.diagnostic.telemetry.IJTracer; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.StatusCode; import io.opentelemetry.context.Context; @@ -29,12 +29,11 @@ public class SafeSpanStack implements Disposable { : upperContext; } - @Nullable - synchronized public Span getCurrentSpan() { + public synchronized @Nullable Span getCurrentSpan() { return myStack.peek(); } - synchronized public void startSpan(@NotNull String activityName) { + public synchronized void startSpan(@NotNull String activityName) { //noinspection DataFlowIssue myStack.push(myTracer .spanBuilder(activityName) @@ -43,7 +42,7 @@ public class SafeSpanStack implements Disposable { .startSpan()); } - synchronized public void endSpan(@NonNls @Nullable String errDescriptionOrNull) { + public synchronized void endSpan(@NonNls @Nullable String errDescriptionOrNull) { if (myStack.isEmpty()) { LOG.warn("Lost span start!"); } @@ -57,7 +56,7 @@ public class SafeSpanStack implements Disposable { } @Override - synchronized public void dispose() { + public synchronized void dispose() { while (!myStack.isEmpty()) { endSpan("External span termination!"); } diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ScriptRunner.java b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ScriptRunner.java index b9d585964140..97a471ed547f 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ScriptRunner.java +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/utils/ScriptRunner.java @@ -26,7 +26,7 @@ public final class ScriptRunner { return this; } - public void doRunScript(@NotNull final Project project, @NotNull String text, @Nullable File workingDir) { + public void doRunScript(final @NotNull Project project, @NotNull String text, @Nullable File workingDir) { PlaybackRunnerExtended runner = new PlaybackRunnerExtended(text, new CommandLogger(), project); runner.setScriptDir(workingDir); diff --git a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfFileType.java b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfFileType.java index cc62343abce5..b4ffcdeb7678 100644 --- a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfFileType.java +++ b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfFileType.java @@ -14,27 +14,23 @@ public final class IJPerfFileType extends LanguageFileType { private IJPerfFileType() {super(IJPerfLanguage.INSTANCE);} - @NotNull @Override - public String getName() { + public @NotNull String getName() { return "IntegrationPerformanceTest"; } - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return PerformanceScriptsBundle.message("filetype.ijperformance.test.display.name"); } - @NotNull @Override - public String getDescription() { + public @NotNull String getDescription() { return PerformanceScriptsBundle.message("filetype.ijperformance.test.description"); } - @NotNull @Override - public String getDefaultExtension() { + public @NotNull String getDefaultExtension() { return DEFAULT_EXTENSION; } diff --git a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfParserDefinition.java b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfParserDefinition.java index 35cc0a974a7b..dacae79c76e5 100644 --- a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfParserDefinition.java +++ b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfParserDefinition.java @@ -20,9 +20,8 @@ public class IJPerfParserDefinition implements ParserDefinition { public static final IFileElementType FILE = new IFileElementType(IJPerfLanguage.INSTANCE); - @NotNull @Override - public Lexer createLexer(Project project) { + public @NotNull Lexer createLexer(Project project) { return new IJPerfLexerAdapter(); } @@ -36,21 +35,18 @@ public class IJPerfParserDefinition implements ParserDefinition { return FILE; } - @NotNull @Override - public TokenSet getCommentTokens() { + public @NotNull TokenSet getCommentTokens() { return IJPerfTokenSets.COMMENTS; } - @NotNull @Override - public TokenSet getStringLiteralElements() { + public @NotNull TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } - @NotNull @Override - public PsiElement createElement(ASTNode node) { + public @NotNull PsiElement createElement(ASTNode node) { return IJPerfElementTypes.Factory.createElement(node); } diff --git a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighter.java b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighter.java index a568bc817380..f0408e22d989 100644 --- a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighter.java +++ b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighter.java @@ -31,9 +31,8 @@ public class IJPerfSyntaxHighlighter extends SyntaxHighlighterBase { public static final TextAttributesKey FILE_PATH = createTextAttributesKey("PERF_PLUGIN_FILE_PATH", DefaultLanguageHighlighterColors.IDENTIFIER); - @NotNull @Override - public Lexer getHighlightingLexer() { + public @NotNull Lexer getHighlightingLexer() { return new IJPerfLexerAdapter(); } diff --git a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighterFactory.java b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighterFactory.java index f39ed57cf56e..ae65aa5d0174 100644 --- a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighterFactory.java +++ b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/IJPerfSyntaxHighlighterFactory.java @@ -8,9 +8,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class IJPerfSyntaxHighlighterFactory extends SyntaxHighlighterFactory { - @NotNull @Override - public SyntaxHighlighter getSyntaxHighlighter(@Nullable Project project, @Nullable VirtualFile virtualFile) { + public @NotNull SyntaxHighlighter getSyntaxHighlighter(@Nullable Project project, @Nullable VirtualFile virtualFile) { return new IJPerfSyntaxHighlighter(); } } diff --git a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/psi/IJPerfFile.java b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/psi/IJPerfFile.java index ddfa9045054c..82fd4a10291c 100644 --- a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/psi/IJPerfFile.java +++ b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/lang/psi/IJPerfFile.java @@ -13,9 +13,8 @@ public class IJPerfFile extends PsiFileBase { super(viewProvider, IJPerfLanguage.INSTANCE); } - @NotNull @Override - public FileType getFileType() { + public @NotNull FileType getFileType() { return IJPerfFileType.INSTANCE; } diff --git a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/ui/ExecuteScriptDialog.java b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/ui/ExecuteScriptDialog.java index 3af7d11f02cf..36a14500a9ce 100644 --- a/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/ui/ExecuteScriptDialog.java +++ b/plugins/performanceTesting/scripts-ui/src/com/jetbrains/performanceScripts/ui/ExecuteScriptDialog.java @@ -27,7 +27,7 @@ public final class ExecuteScriptDialog extends DialogWrapper { private final ScriptRunner myScriptRunner; private final Action execute; - public ExecuteScriptDialog(@NotNull final Project project) { + public ExecuteScriptDialog(final @NotNull Project project) { super(project); this.project = project; myScriptRunner = new ScriptRunner(); @@ -74,9 +74,8 @@ public final class ExecuteScriptDialog extends DialogWrapper { INSPECTION } - @NotNull @Contract(pure = true) - private static String generateTestScript(@NotNull PerformanceScriptType scriptType) { + private static @NotNull String generateTestScript(@NotNull PerformanceScriptType scriptType) { return switch (scriptType) { case TYPING -> """ %delayType 150|Sample text for typing scenario @@ -111,15 +110,13 @@ public final class ExecuteScriptDialog extends DialogWrapper { }; } - @Nullable @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return scriptText; } - @Nullable @Override - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myMainPanel; } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/actions/TempWithQueryAction.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/actions/TempWithQueryAction.java index b7a926c686c0..d1b0e2e054d4 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/actions/TempWithQueryAction.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/actions/TempWithQueryAction.java @@ -1,5 +1,5 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.refactoring.actions; import com.intellij.openapi.actionSystem.DataContext; @@ -28,7 +28,7 @@ public class TempWithQueryAction extends BaseJavaRefactoringAction{ } @Override - protected boolean isAvailableOnElementInEditorAndFile(@NotNull final PsiElement element, @NotNull final Editor editor, @NotNull PsiFile file, @NotNull DataContext context) { + protected boolean isAvailableOnElementInEditorAndFile(final @NotNull PsiElement element, final @NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext context) { return element instanceof PsiLocalVariable && ((PsiLocalVariable) element).getInitializer() != null; } } \ No newline at end of file diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanDialog.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanDialog.java index 3dc96ed921da..1b0d77e47cde 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanDialog.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanDialog.java @@ -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 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.refactoring.removemiddleman; import com.intellij.psi.PsiField; @@ -52,7 +52,7 @@ public class RemoveMiddlemanDialog extends RefactoringDialog { final MemberSelectionTable table = selectionPanel.getTable(); table.setMemberInfoModel(new DelegatingMemberInfoModel<>(table.getMemberInfoModel()) { @Override - public int checkForProblems(@NotNull final MemberInfo member) { + public int checkForProblems(final @NotNull MemberInfo member) { return hasSuperMethods(member) ? ERROR : OK; } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanHandler.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanHandler.java index 816451d0c36a..5b269e8a91e1 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanHandler.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanHandler.java @@ -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 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.refactoring.removemiddleman; import com.intellij.openapi.actionSystem.CommonDataKeys; @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; import java.util.Set; public class RemoveMiddlemanHandler implements RefactoringActionHandler { - @NonNls static final String REMOVE_METHODS = "refactoring.removemiddleman.remove.methods"; + static final @NonNls String REMOVE_METHODS = "refactoring.removemiddleman.remove.methods"; protected static String getRefactoringName() { return getRefactoringNameText(); diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanProcessor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanProcessor.java index 2d9eb5233007..783fb7993afa 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanProcessor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanProcessor.java @@ -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 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.refactoring.removemiddleman; import com.intellij.codeInsight.generation.GenerateMembersUtil; @@ -42,8 +42,7 @@ public class RemoveMiddlemanProcessor extends FixableUsagesRefactoringProcessor } @Override - @NotNull - protected UsageViewDescriptor createUsageViewDescriptor(UsageInfo @NotNull [] usageInfos) { + protected @NotNull UsageViewDescriptor createUsageViewDescriptor(UsageInfo @NotNull [] usageInfos) { return new RemoveMiddlemanUsageViewDescriptor(field); } @@ -62,7 +61,7 @@ public class RemoveMiddlemanProcessor extends FixableUsagesRefactoringProcessor } @Override - protected boolean preprocessUsages(@NotNull final Ref refUsages) { + protected boolean preprocessUsages(final @NotNull Ref refUsages) { final MultiMap conflicts = new MultiMap<>(); for (MemberInfo memberInfo : myDelegateMethodInfos) { if (memberInfo.isChecked() && memberInfo.isToAbstract()) { @@ -114,8 +113,7 @@ public class RemoveMiddlemanProcessor extends FixableUsagesRefactoringProcessor } @Override - @NotNull - protected String getCommandName() { + protected @NotNull String getCommandName() { return JavaRareRefactoringsBundle.message("exposed.delegation.command.name", StringUtil.getQualifiedName(containingClass.getName(), field.getName())); } } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanUsageViewDescriptor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanUsageViewDescriptor.java index d488674379b6..fa1a8b080c5d 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanUsageViewDescriptor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/removemiddleman/RemoveMiddlemanUsageViewDescriptor.java @@ -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 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.refactoring.removemiddleman; import com.intellij.psi.PsiElement; @@ -8,16 +8,15 @@ import com.intellij.usageView.UsageViewDescriptor; import org.jetbrains.annotations.NotNull; class RemoveMiddlemanUsageViewDescriptor implements UsageViewDescriptor { - private @NotNull final PsiField field; + private final @NotNull PsiField field; RemoveMiddlemanUsageViewDescriptor(@NotNull PsiField field) { super(); this.field = field; } - @NotNull @Override - public String getCodeReferencesText(int usagesCount, int filesCount) { + public @NotNull String getCodeReferencesText(int usagesCount, int filesCount) { return JavaRareRefactoringsBundle .message("references.to.expose.usage.view", usagesCount, filesCount); } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/tempWithQuery/TempWithQueryHandler.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/tempWithQuery/TempWithQueryHandler.java index 7a8205c75565..30f592a7e752 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/tempWithQuery/TempWithQueryHandler.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/tempWithQuery/TempWithQueryHandler.java @@ -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 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.refactoring.tempWithQuery; import com.intellij.codeInsight.TargetElementUtil; @@ -38,7 +38,7 @@ public class TempWithQueryHandler implements RefactoringActionHandler { private static final Logger LOG = Logger.getInstance(TempWithQueryHandler.class); @Override - public void invoke(@NotNull final Project project, final Editor editor, PsiFile file, DataContext dataContext) { + public void invoke(final @NotNull Project project, final Editor editor, PsiFile file, DataContext dataContext) { PsiElement element = TargetElementUtil.findTargetElement(editor, TargetElementUtil .ELEMENT_NAME_ACCEPTED | TargetElementUtil diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookDialog.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookDialog.java index 8b4351915484..3fac3d237f46 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookDialog.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookDialog.java @@ -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.refactoring.typeCook; import com.intellij.lang.findUsages.DescriptiveNameUtil; @@ -192,8 +192,7 @@ public class TypeCookDialog extends RefactoringDialog { }; } - @Nls - public static String getRefactoringName() { + public static @Nls String getRefactoringName() { return JavaRareRefactoringsBundle.message("generify.title"); } } \ No newline at end of file diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookProcessor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookProcessor.java index a41503164abf..7265e4671af8 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookProcessor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookProcessor.java @@ -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.refactoring.typeCook; import com.intellij.openapi.project.Project; @@ -33,8 +33,7 @@ public class TypeCookProcessor extends BaseRefactoringProcessor { } @Override - @NotNull - protected UsageViewDescriptor createUsageViewDescriptor(UsageInfo @NotNull [] usages) { + protected @NotNull UsageViewDescriptor createUsageViewDescriptor(UsageInfo @NotNull [] usages) { return new TypeCookViewDescriptor(myElements); } @@ -106,8 +105,7 @@ public class TypeCookProcessor extends BaseRefactoringProcessor { } @Override - @NotNull - protected String getCommandName() { + protected @NotNull String getCommandName() { return JavaRareRefactoringsBundle.message("type.cook.command"); } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookViewDescriptor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookViewDescriptor.java index 976464834348..6185dc42f67a 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookViewDescriptor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/TypeCookViewDescriptor.java @@ -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.refactoring.typeCook; import com.intellij.psi.PsiElement; @@ -24,9 +24,8 @@ class TypeCookViewDescriptor implements UsageViewDescriptor { return JavaRareRefactoringsBundle.message("type.cook.elements.header"); } - @NotNull @Override - public String getCodeReferencesText(int usagesCount, int filesCount) { + public @NotNull String getCodeReferencesText(int usagesCount, int filesCount) { return JavaRareRefactoringsBundle.message("declaration.s.to.be.generified", UsageViewBundle.getReferencesString(usagesCount, filesCount)); } } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiExtendedTypeVisitor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiExtendedTypeVisitor.java index 1816e4b30285..470e96016699 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiExtendedTypeVisitor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiExtendedTypeVisitor.java @@ -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.refactoring.typeCook.deductive; import com.intellij.psi.PsiClassType; @@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; public abstract class PsiExtendedTypeVisitor extends PsiTypeVisitorEx { @Override - public X visitClassType(@NotNull final PsiClassType classType) { + public X visitClassType(final @NotNull PsiClassType classType) { super.visitClassType(classType); final PsiClassType.ClassResolveResult result = classType.resolveGenerics(); diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java index 57d1181302df..5b5c1cebde30 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/PsiTypeVariableFactory.java @@ -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.refactoring.typeCook.deductive; import com.intellij.psi.*; @@ -55,17 +55,17 @@ public class PsiTypeVariableFactory { return type.accept(new PsiTypeVisitor() { @Override - public Boolean visitType(@NotNull final PsiType type) { + public Boolean visitType(final @NotNull PsiType type) { return Boolean.TRUE; } @Override - public Boolean visitArrayType(@NotNull final PsiArrayType arrayType) { + public Boolean visitArrayType(final @NotNull PsiArrayType arrayType) { return arrayType.getDeepComponentType().accept(this); } @Override - public Boolean visitWildcardType(@NotNull final PsiWildcardType wildcardType) { + public Boolean visitWildcardType(final @NotNull PsiWildcardType wildcardType) { final PsiType bound = wildcardType.getBound(); if (bound != null) { @@ -76,7 +76,7 @@ public class PsiTypeVariableFactory { } @Override - public Boolean visitClassType(@NotNull final PsiClassType classType) { + public Boolean visitClassType(final @NotNull PsiClassType classType) { final PsiClassType.ClassResolveResult result = classType.resolveGenerics(); final PsiClass aClass = result.getElement(); final PsiSubstitutor aSubst = result.getSubstitutor(); @@ -130,14 +130,12 @@ public class PsiTypeVariableFactory { } @Override - @NotNull - public String getPresentableText() { + public @NotNull String getPresentableText() { return "$" + myIndex; } @Override - @NotNull - public String getCanonicalText() { + public @NotNull String getCanonicalText() { return getPresentableText(); } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/ReductionSystem.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/ReductionSystem.java index 3f82ae5dec99..63e824bb26ed 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/ReductionSystem.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/ReductionSystem.java @@ -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.refactoring.typeCook.deductive.builder; import com.intellij.openapi.project.Project; @@ -338,7 +338,7 @@ public class ReductionSystem { return StreamEx.of(data).sorted().map(aData -> aData + "\n").joining(); } - @NonNls private static + private static @NonNls String elementString(final PsiElement element) { if (element instanceof PsiNewExpression) { return "new"; diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/Result.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/Result.java index a2d20fbde114..331bf3cc6178 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/Result.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/Result.java @@ -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.refactoring.typeCook.deductive.builder; import com.intellij.openapi.diagnostic.Logger; @@ -53,7 +53,7 @@ public class Result { if (myBinding != null) { final PsiType type = myBinding.substitute(myTypes.get(element)); - @NonNls final String objectFQName = CommonClassNames.JAVA_LANG_OBJECT; + final @NonNls String objectFQName = CommonClassNames.JAVA_LANG_OBJECT; if (originalType.getCanonicalText().equals(objectFQName)) { if (type == null) { return originalType; diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/Binding.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/Binding.java index e78c020c79d2..26b13d5ae9da 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/Binding.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/Binding.java @@ -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.refactoring.typeCook.deductive.resolver; import com.intellij.psi.PsiType; @@ -13,10 +13,10 @@ public abstract class Binding { abstract Binding compose(Binding b); - final static int BETTER = 0; - final static int WORSE = 1; - final static int SAME = 2; - final static int NONCOMPARABLE = 3; + static final int BETTER = 0; + static final int WORSE = 1; + static final int SAME = 2; + static final int NONCOMPARABLE = 3; abstract int compare(Binding b); diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java index 1dbd570b7dff..4f089faa71ca 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/BindingFactory.java @@ -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.refactoring.typeCook.deductive.resolver; import com.intellij.openapi.diagnostic.Logger; @@ -440,7 +440,7 @@ public class BindingFactory { class Verifier extends PsiExtendedTypeVisitor { boolean myFlag; - @Override public Void visitTypeVariable(@NotNull final PsiTypeVariable var) { + @Override public Void visitTypeVariable(final @NotNull PsiTypeVariable var) { if (var.getIndex() == index) { myFlag = true; } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java index af556ab7b770..f430020cd133 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/resolver/ResolverTree.java @@ -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.refactoring.typeCook.deductive.resolver; import com.intellij.openapi.diagnostic.Logger; @@ -64,7 +64,7 @@ public final class ResolverTree { final Set mySet = new HashSet<>(); @Override - public Object visitTypeVariable(@NotNull final PsiTypeVariable var) { + public Object visitTypeVariable(final @NotNull PsiTypeVariable var) { mySet.add(var); return null; @@ -190,15 +190,13 @@ public final class ResolverTree { } final DFSTBuilder dfstBuilder = new DFSTBuilder<>(new Graph<>() { - @NotNull @Override - public Collection getNodes() { + public @NotNull Collection getNodes() { return nodes; } - @NotNull @Override - public Iterator getIn(final PsiTypeVariable n) { + public @NotNull Iterator getIn(final PsiTypeVariable n) { final Set in = ins.get(n); if (in == null) { @@ -208,9 +206,8 @@ public final class ResolverTree { return in.iterator(); } - @NotNull @Override - public Iterator getOut(final PsiTypeVariable n) { + public @NotNull Iterator getOut(final PsiTypeVariable n) { final Set out = outs.get(n); if (out == null) { diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java index 702dfda50da0..d48f8f0e2d6b 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueDialog.java @@ -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 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.refactoring.wrapreturnvalue; import com.intellij.ide.util.TreeClassChooser; @@ -122,18 +122,15 @@ class WrapReturnValueDialog extends RefactoringDialog { } } - @NotNull - private String getInnerClassName() { + private @NotNull String getInnerClassName() { return myInnerClassNameTextField.getText().trim(); } - @NotNull - public String getPackageName() { + public @NotNull String getPackageName() { return packageTextField.getText().trim(); } - @NotNull - public String getClassName() { + public @NotNull String getClassName() { return classNameField.getText().trim(); } @@ -143,7 +140,7 @@ class WrapReturnValueDialog extends RefactoringDialog { final DocumentListener docListener = new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { validateButtons(); } }; diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueProcessor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueProcessor.java index 8b3ad212454d..5ad858926a44 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueProcessor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueProcessor.java @@ -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.refactoring.wrapreturnvalue; import com.intellij.ide.highlighter.JavaFileType; @@ -47,15 +47,14 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor private final MoveDestination myMoveDestination; private final PsiMethod myMethod; - @NotNull - private final String myClassName; + private final @NotNull String myClassName; private final String myPackageName; private final boolean myCreateInnerClass; private final PsiField myDelegateField; private final String myQualifiedName; private final boolean myUseExistingClass; private final List myTypeParameters; - @NonNls private final String myUnwrapMethodName; + private final @NonNls String myUnwrapMethodName; public WrapReturnValueProcessor(@NotNull String className, String packageName, @@ -88,8 +87,7 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor } } - @NonNls - private String calculateUnwrapMethodName() { + private @NonNls String calculateUnwrapMethodName() { final PsiClass existingClass = JavaPsiFacade.getInstance(myProject).findClass(myQualifiedName, GlobalSearchScope.allScope(myProject)); if (existingClass != null) { if (TypeConversionUtil.isPrimitiveWrapper(myQualifiedName)) { @@ -105,9 +103,8 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor return ""; } - @NotNull @Override - protected UsageViewDescriptor createUsageViewDescriptor(UsageInfo @NotNull [] usageInfos) { + protected @NotNull UsageViewDescriptor createUsageViewDescriptor(UsageInfo @NotNull [] usageInfos) { return new WrapReturnValueUsageViewDescriptor(myMethod, usageInfos); } @@ -174,7 +171,7 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor } @Override - protected boolean preprocessUsages(@NotNull final Ref refUsages) { + protected boolean preprocessUsages(final @NotNull Ref refUsages) { MultiMap conflicts = new MultiMap<>(); PsiClass existingClass = JavaPsiFacade.getInstance(myProject).findClass(myQualifiedName, GlobalSearchScope.allScope(myProject)); if (myUseExistingClass) { @@ -330,8 +327,7 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor } @Override - @NotNull - protected String getCommandName() { + protected @NotNull String getCommandName() { final PsiClass containingClass = myMethod.getContainingClass(); return JavaRareRefactoringsBundle.message("wrapped.return.command.name", myClassName, StringUtil.getQualifiedName(containingClass.getName(), myMethod.getName())); } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueUsageViewDescriptor.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueUsageViewDescriptor.java index cca567d0ab8a..f2a0fadf583a 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueUsageViewDescriptor.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/wrapreturnvalue/WrapReturnValueUsageViewDescriptor.java @@ -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 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.refactoring.wrapreturnvalue; import com.intellij.psi.PsiElement; @@ -10,8 +10,7 @@ import org.jetbrains.annotations.NotNull; class WrapReturnValueUsageViewDescriptor implements UsageViewDescriptor { - @NotNull - private final PsiMethod method; + private final @NotNull PsiMethod method; WrapReturnValueUsageViewDescriptor(@NotNull PsiMethod method, UsageInfo[] usages){ @@ -29,9 +28,8 @@ class WrapReturnValueUsageViewDescriptor implements UsageViewDescriptor { return JavaRareRefactoringsBundle.message("method.whose.return.are.to.wrapped"); } - @NotNull @Override - public String getCodeReferencesText(int usagesCount, int filesCount){ + public @NotNull String getCodeReferencesText(int usagesCount, int filesCount){ return JavaRareRefactoringsBundle.message("references.to.be.modified.usage.view", usagesCount, filesCount); } } diff --git a/plugins/repository-search/src/main/java/org/jetbrains/idea/maven/onlinecompletion/model/MavenDependencyCompletionItem.java b/plugins/repository-search/src/main/java/org/jetbrains/idea/maven/onlinecompletion/model/MavenDependencyCompletionItem.java index 54349dfdd26a..7166d303abb5 100644 --- a/plugins/repository-search/src/main/java/org/jetbrains/idea/maven/onlinecompletion/model/MavenDependencyCompletionItem.java +++ b/plugins/repository-search/src/main/java/org/jetbrains/idea/maven/onlinecompletion/model/MavenDependencyCompletionItem.java @@ -4,7 +4,6 @@ package org.jetbrains.idea.maven.onlinecompletion.model; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.model.MavenId; -import org.jetbrains.idea.reposearch.RepositoryArtifactData; @ApiStatus.Experimental public class MavenDependencyCompletionItem extends MavenId { @@ -63,8 +62,7 @@ public class MavenDependencyCompletionItem extends MavenId { this(coord, null); } - @Nullable - public Type getType() { + public @Nullable Type getType() { return myType; } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestColorsPage.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestColorsPage.java index c18f80710afc..e5f50708b01b 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestColorsPage.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestColorsPage.java @@ -31,12 +31,11 @@ public class RestColorsPage implements ColorSettingsPage { new AttributesDescriptor(RestBundle.message("literal.and.line.blocks"), RestSyntaxHighlighter.REST_INLINE), }; - @NonNls private static final HashMap ourTagToDescriptorMap = new HashMap<>(); + private static final @NonNls HashMap ourTagToDescriptorMap = new HashMap<>(); @Override - @NotNull - public String getDisplayName() { + public @NotNull String getDisplayName() { return RestBundle.message("restructured.text"); } @@ -56,16 +55,14 @@ public class RestColorsPage implements ColorSettingsPage { } @Override - @NotNull - public SyntaxHighlighter getHighlighter() { + public @NotNull SyntaxHighlighter getHighlighter() { final SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(RestFileType.INSTANCE, null, null); assert highlighter != null; return highlighter; } @Override - @NotNull - public String getDemoText() { + public @NotNull String getDemoText() { return """ .. comment for documentation master file diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFile.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFile.java index 7e3c7767ed55..08a5cd13cf13 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFile.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFile.java @@ -16,8 +16,7 @@ public class RestFile extends PsiFileImpl { } @Override - @NotNull - public FileType getFileType() { + public @NotNull FileType getFileType() { return RestFileType.INSTANCE; } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFileType.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFileType.java index 66d28da6eb0f..1f4bb0ff8166 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFileType.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestFileType.java @@ -14,27 +14,24 @@ import javax.swing.*; */ public final class RestFileType extends LanguageFileType { public static final RestFileType INSTANCE = new RestFileType(); - @NonNls public static final String DEFAULT_EXTENSION = "rst"; + public static final @NonNls String DEFAULT_EXTENSION = "rst"; private RestFileType() { super(RestLanguage.INSTANCE); } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return "ReST"; } @Override - @NotNull - public String getDescription() { + public @NotNull String getDescription() { return RestBundle.message("restructured.text"); } @Override - @NotNull - public String getDefaultExtension() { + public @NotNull String getDefaultExtension() { return DEFAULT_EXTENSION; } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestHighlighterFactory.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestHighlighterFactory.java index b23ac8e94c22..30eede79f90f 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestHighlighterFactory.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestHighlighterFactory.java @@ -12,9 +12,8 @@ import org.jetbrains.annotations.NotNull; */ public class RestHighlighterFactory extends SyntaxHighlighterFactory { - @NotNull @Override - public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { + public @NotNull SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) { return new RestSyntaxHighlighter(); } } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestIndexPatternBuilder.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestIndexPatternBuilder.java index 6c1998425c47..2ab889237eee 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestIndexPatternBuilder.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestIndexPatternBuilder.java @@ -13,18 +13,16 @@ import org.jetbrains.annotations.Nullable; public class RestIndexPatternBuilder implements IndexPatternBuilder { public static final TokenSet COMMENTS = TokenSet.create(RestTokenTypes.COMMENT); - @Nullable @Override - public Lexer getIndexingLexer(@NotNull PsiFile file) { + public @Nullable Lexer getIndexingLexer(@NotNull PsiFile file) { if (file instanceof RestFile) { return new RestFlexLexer(); } return null; } - @Nullable @Override - public TokenSet getCommentTokenSet(@NotNull PsiFile file) { + public @Nullable TokenSet getCommentTokenSet(@NotNull PsiFile file) { if (file instanceof RestFile) { return COMMENTS; } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestLanguage.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestLanguage.java index f91ee1efba6c..092fe6035ff0 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestLanguage.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestLanguage.java @@ -19,9 +19,8 @@ public final class RestLanguage extends Language implements TemplateLanguage { super("ReST"); } - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return RestBundle.message("rest.language"); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestSyntaxHighlighter.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestSyntaxHighlighter.java index 56c8237f91e0..3ad75bbdbe05 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestSyntaxHighlighter.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestSyntaxHighlighter.java @@ -95,8 +95,7 @@ public class RestSyntaxHighlighter extends SyntaxHighlighterBase implements Rest } @Override - @NotNull - public Lexer getHighlightingLexer() { + public @NotNull Lexer getHighlightingLexer() { return new RestFlexLexer(); } } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestTodoIndexer.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestTodoIndexer.java index f72d4faf83c3..ee9c2e6b1d54 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestTodoIndexer.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestTodoIndexer.java @@ -11,9 +11,8 @@ import com.intellij.restructuredtext.lexer.RestFlexLexer; import org.jetbrains.annotations.NotNull; public class RestTodoIndexer extends LexerBasedTodoIndexer { - @NotNull @Override - public Lexer createLexer(@NotNull OccurrenceConsumer consumer) { + public @NotNull Lexer createLexer(@NotNull OccurrenceConsumer consumer) { return new BaseFilterLexer(new RestFlexLexer(), consumer) { @Override public void advance() { diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestUtil.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestUtil.java index 2362ee556d0c..56fde30c931f 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/RestUtil.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/RestUtil.java @@ -129,13 +129,13 @@ public final class RestUtil { DIRECTIVES.put("restructuredtext-test-directive::", new String[] {}); } - static public String[] getDirectiveOptions(String directive) { + public static String[] getDirectiveOptions(String directive) { if (DIRECTIVES.containsKey(directive)) return DIRECTIVES.get(directive); return new String[]{}; } - static public Set getDirectives() { + public static Set getDirectives() { return DIRECTIVES.keySet(); } } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/actions/RestFillParagraphHandler.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/actions/RestFillParagraphHandler.java index f05e51f3fcfb..c9a05ce9ea17 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/actions/RestFillParagraphHandler.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/actions/RestFillParagraphHandler.java @@ -17,14 +17,12 @@ import org.jetbrains.annotations.Nullable; public class RestFillParagraphHandler extends ParagraphFillHandler { @Override - @NotNull - protected String getPrefix(@NotNull final PsiElement element) { + protected @NotNull String getPrefix(final @NotNull PsiElement element) { return element instanceof PsiComment? ".. " : ""; } - @NotNull @Override - protected String getPostfix(@NotNull PsiElement element) { + protected @NotNull String getPostfix(@NotNull PsiElement element) { return element.getNode().getElementType() == RestTokenTypes.COMMENT ? "\n" : ""; } @@ -39,7 +37,7 @@ public class RestFillParagraphHandler extends ParagraphFillHandler { } @Override - protected boolean atWhitespaceToken(@Nullable final PsiElement element) { + protected boolean atWhitespaceToken(final @Nullable PsiElement element) { return element instanceof PsiWhiteSpace || element != null && element.getNode().getElementType() == RestTokenTypes.WHITESPACE; } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/editor/RestEditorProvider.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/editor/RestEditorProvider.java index 201c167c247e..55f17bd72271 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/editor/RestEditorProvider.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/editor/RestEditorProvider.java @@ -1,7 +1,9 @@ // 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.restructuredtext.editor; -import com.intellij.openapi.fileEditor.*; +import com.intellij.openapi.fileEditor.FileEditor; +import com.intellij.openapi.fileEditor.FileEditorPolicy; +import com.intellij.openapi.fileEditor.FileEditorProvider; import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; import com.intellij.openapi.fileTypes.FileTypeRegistry; import com.intellij.openapi.project.DumbAware; @@ -21,21 +23,18 @@ public class RestEditorProvider implements FileEditorProvider, DumbAware { return false; } - @NotNull @Override - public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { + public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) { return TextEditorProvider.getInstance().createEditor(project, file); } - @NotNull @Override - public String getEditorTypeId() { + public @NotNull String getEditorTypeId() { return "restructured-text-editor"; } - @NotNull @Override - public FileEditorPolicy getPolicy() { + public @NotNull FileEditorPolicy getPolicy() { return FileEditorPolicy.HIDE_DEFAULT_EDITOR; } } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestBlock.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestBlock.java index bce02d7e19d8..6eb043737c91 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestBlock.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestBlock.java @@ -35,15 +35,13 @@ public class RestBlock implements ASTBlock { return myNode; } - @NotNull @Override - public TextRange getTextRange() { + public @NotNull TextRange getTextRange() { return myNode.getTextRange(); } @Override - @NotNull - public List getSubBlocks() { + public @NotNull List getSubBlocks() { if (mySubBlocks == null) { mySubBlocks = buildSubBlocks(); } @@ -76,33 +74,28 @@ public class RestBlock implements ASTBlock { } - @Nullable @Override - public Wrap getWrap() { + public @Nullable Wrap getWrap() { return myWrap; } - @Nullable @Override - public Indent getIndent() { + public @Nullable Indent getIndent() { return myIndent; } - @Nullable @Override - public Alignment getAlignment() { + public @Nullable Alignment getAlignment() { return myAlignment; } - @Nullable @Override - public Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { + public @Nullable Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) { return null; } - @NotNull @Override - public ChildAttributes getChildAttributes(int newChildIndex) { + public @NotNull ChildAttributes getChildAttributes(int newChildIndex) { return new ChildAttributes(Indent.getNoneIndent(), null); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestFormattingModelBuilder.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestFormattingModelBuilder.java index fdbecc7a731a..baff74698432 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestFormattingModelBuilder.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/formatter/RestFormattingModelBuilder.java @@ -28,9 +28,8 @@ public class RestFormattingModelBuilder implements FormattingModelBuilder, Custo .createFormattingModelForPsiFile(formattingContext.getContainingFile(), block, formattingContext.getCodeStyleSettings()); } - @Nullable @Override - public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) { + public @Nullable TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) { final PsiElement element = elementAtOffset.getPsi(); final PsiElement container = element.getParent(); return container != null ? container.getTextRange() : null; diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspection.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspection.java index 70070205b793..d992890e61a6 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspection.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspection.java @@ -13,16 +13,13 @@ import org.jetbrains.annotations.Nullable; * User : catherine */ public abstract class RestInspection extends LocalInspectionTool { - @Nls - @NotNull @Override - public String getGroupDisplayName() { + public @Nls @NotNull String getGroupDisplayName() { return RestBundle.message("INSP.GROUP.rest"); } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return getClass().getSimpleName(); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspectionVisitor.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspectionVisitor.java index a47f6bdaffd8..09a7d22ffc2f 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspectionVisitor.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/inspections/RestInspectionVisitor.java @@ -13,15 +13,15 @@ import org.jetbrains.annotations.Nullable; * User : catherine */ public abstract class RestInspectionVisitor extends RestElementVisitor { - @Nullable private final ProblemsHolder myHolder; + private final @Nullable ProblemsHolder myHolder; - public RestInspectionVisitor(@Nullable final ProblemsHolder holder) { + public RestInspectionVisitor(final @Nullable ProblemsHolder holder) { myHolder = holder; } - protected final void registerProblem(@Nullable final PsiElement element, - @NotNull final @InspectionMessage String message, - @NotNull final LocalQuickFix quickFix) { + protected final void registerProblem(final @Nullable PsiElement element, + final @NotNull @InspectionMessage String message, + final @NotNull LocalQuickFix quickFix) { if (element == null || element.getTextLength() == 0) { return; } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParser.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParser.java index 93415646da24..b492c520b3a9 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParser.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParser.java @@ -15,8 +15,7 @@ import org.jetbrains.annotations.NotNull; */ public class RestParser implements PsiParser { @Override - @NotNull - public ASTNode parse(@NotNull IElementType root, @NotNull PsiBuilder builder) { + public @NotNull ASTNode parse(@NotNull IElementType root, @NotNull PsiBuilder builder) { final PsiBuilder.Marker rootMarker = builder.mark(); while (!builder.eof()) { IElementType type = builder.getTokenType(); diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParserDefinition.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParserDefinition.java index 057d2f316ec1..c299d31d1f3a 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParserDefinition.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/parsing/RestParserDefinition.java @@ -26,9 +26,8 @@ public class RestParserDefinition implements ParserDefinition, RestTokenTypes { private final RestASTFactory astFactory = new RestASTFactory(); - @NotNull @Override - public Lexer createLexer(Project project) { + public @NotNull Lexer createLexer(Project project) { return new RestFlexLexer(); } @@ -42,27 +41,23 @@ public class RestParserDefinition implements ParserDefinition, RestTokenTypes { return FILE_ELEMENT_TYPE; } - @NotNull @Override - public TokenSet getWhitespaceTokens() { + public @NotNull TokenSet getWhitespaceTokens() { return TokenSet.EMPTY; } - @NotNull @Override - public TokenSet getCommentTokens() { + public @NotNull TokenSet getCommentTokens() { return TokenSet.EMPTY; } - @NotNull @Override - public TokenSet getStringLiteralElements() { + public @NotNull TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } - @NotNull @Override - public PsiElement createElement(ASTNode node) { + public @NotNull PsiElement createElement(ASTNode node) { return astFactory.create(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestDirectiveBlock.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestDirectiveBlock.java index fb51ef4133c0..3570f524ca1c 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestDirectiveBlock.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestDirectiveBlock.java @@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; * User : catherine */ public class RestDirectiveBlock extends RestElement { - public RestDirectiveBlock(@NotNull final ASTNode node) { + public RestDirectiveBlock(final @NotNull ASTNode node) { super(node); } @@ -18,8 +18,7 @@ public class RestDirectiveBlock extends RestElement { return "RestDirective:" + getNode().getElementType().toString(); } - @NotNull - public String getDirectiveName() { + public @NotNull String getDirectiveName() { PsiElement child = this.getFirstChild(); if (child != null) return child.getText(); diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestElement.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestElement.java index 017ab40522d9..a2875e3a4702 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestElement.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestElement.java @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; public class RestElement extends ASTWrapperPsiElement implements NavigatablePsiElement { - public RestElement(@NotNull final ASTNode node) { + public RestElement(final @NotNull ASTNode node) { super(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestFieldList.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestFieldList.java index ed999d9f8ce7..3bec861c9c06 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestFieldList.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestFieldList.java @@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; * User : ktisha */ public class RestFieldList extends RestElement { - public RestFieldList(@NotNull final ASTNode node) { + public RestFieldList(final @NotNull ASTNode node) { super(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestInlineBlock.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestInlineBlock.java index a39e7ffb942d..ba1838976d90 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestInlineBlock.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestInlineBlock.java @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; * User : catherine */ public class RestInlineBlock extends RestElement { - public RestInlineBlock(@NotNull final ASTNode node) { + public RestInlineBlock(final @NotNull ASTNode node) { super(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestLine.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestLine.java index e70b2e1f0e21..ee5ac6533d43 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestLine.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestLine.java @@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull; * User : ktisha */ public class RestLine extends RestElement implements PsiLanguageInjectionHost { - public RestLine(@NotNull final ASTNode node) { + public RestLine(final @NotNull ASTNode node) { super(node); } @@ -35,9 +35,8 @@ public class RestLine extends RestElement implements PsiLanguageInjectionHost { return this; } - @NotNull @Override - public LiteralTextEscaper createLiteralTextEscaper() { + public @NotNull LiteralTextEscaper createLiteralTextEscaper() { return new LiteralTextEscaper(this) { @Override public boolean decode(@NotNull TextRange rangeInsideHost, @NotNull StringBuilder outChars) { diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReference.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReference.java index 76184f570cb6..80d914ab4a12 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReference.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReference.java @@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull; * User : catherine */ public class RestReference extends RestElement { - public RestReference(@NotNull final ASTNode node) { + public RestReference(final @NotNull ASTNode node) { super(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReferenceTarget.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReferenceTarget.java index 276b3beeca99..9b8510b7eb4c 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReferenceTarget.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestReferenceTarget.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; * User : catherine */ public class RestReferenceTarget extends RestElement { - public RestReferenceTarget(@NotNull final ASTNode node) { + public RestReferenceTarget(final @NotNull ASTNode node) { super(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestRole.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestRole.java index 73ba3994302d..c7dc8b576580 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestRole.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestRole.java @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; * User : catherine */ public class RestRole extends RestElement { - public RestRole(@NotNull final ASTNode node) { + public RestRole(final @NotNull ASTNode node) { super(node); } diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestTitle.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestTitle.java index 1df1080d1fce..21ae7c2ff39d 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestTitle.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/psi/RestTitle.java @@ -16,7 +16,7 @@ import java.text.StringCharacterIterator; public class RestTitle extends RestElement { private static final String ourAdornmentSymbols = "=-`:.'\\~^_*+#>"; - public RestTitle(@NotNull final ASTNode node) { + public RestTitle(final @NotNull ASTNode node) { super(node); } @@ -26,8 +26,7 @@ public class RestTitle extends RestElement { } @Override - @Nullable - public String getName() { + public @Nullable String getName() { final String text = getNode().getText().trim(); if (text.length() < 2) return null; final char adorn = text.charAt(text.length()-2); @@ -53,8 +52,7 @@ public class RestTitle extends RestElement { return text.substring(start, finish).trim(); } - @Nullable - public String getOverline() { + public @Nullable String getOverline() { final String text = getNode().getText().trim(); final Pair adornments = getAdornments(); final Character overlineChar = adornments.getFirst(); @@ -69,8 +67,7 @@ public class RestTitle extends RestElement { return text.substring(0, end); } - @Nullable - public String getUnderline() { + public @Nullable String getUnderline() { final String text = getNode().getText().trim(); if (text.length() < 2) return null; final char adorn = text.charAt(text.length()-1); diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/spellchecker/RestSpellcheckerStrategy.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/spellchecker/RestSpellcheckerStrategy.java index 4277bf0383a1..1ada80627a81 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/spellchecker/RestSpellcheckerStrategy.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/spellchecker/RestSpellcheckerStrategy.java @@ -22,9 +22,8 @@ public class RestSpellcheckerStrategy extends SpellcheckingStrategy implements D } }; - @NotNull @Override - public Tokenizer getTokenizer(PsiElement element) { + public @NotNull Tokenizer getTokenizer(PsiElement element) { IElementType elementType = element.getNode().getElementType(); if (elementType == RestTokenTypes.FIELD || elementType == RestTokenTypes.CUSTOM_DIRECTIVE || diff --git a/plugins/restructuredtext/src/com/intellij/restructuredtext/structureView/RestStructureViewElement.java b/plugins/restructuredtext/src/com/intellij/restructuredtext/structureView/RestStructureViewElement.java index 89ec9a68e1fd..603a7ab0073c 100644 --- a/plugins/restructuredtext/src/com/intellij/restructuredtext/structureView/RestStructureViewElement.java +++ b/plugins/restructuredtext/src/com/intellij/restructuredtext/structureView/RestStructureViewElement.java @@ -27,9 +27,8 @@ public class RestStructureViewElement extends PsiTreeElementBase getChildrenBase() { + public @NotNull Collection getChildrenBase() { Collection result = new LinkedList<>(); final NavigatablePsiElement element = getElement(); @@ -79,9 +78,8 @@ public class RestStructureViewElement extends PsiTreeElementBase MAN_EXECUTABLE = atomicLazyNullable(() -> { String path = EnvironmentUtil.getValue("PATH"); @@ -66,10 +66,9 @@ final class ShDocumentationProvider implements DocumentationProvider { && (o.getParent().getParent() instanceof ShGenericCommandDirective); } - @Nullable @Override - public PsiElement getCustomDocumentationElement(@NotNull Editor editor, @NotNull PsiFile file, @Nullable PsiElement contextElement, - int targetOffset) { + public @Nullable PsiElement getCustomDocumentationElement(@NotNull Editor editor, @NotNull PsiFile file, @Nullable PsiElement contextElement, + int targetOffset) { ASTNode node = contextElement == null ? null : contextElement.getNode(); if (node == null || (TreeUtil.isWhitespaceOrComment(node) || node.getElementType() == ShTypes.LINEFEED)) { PsiElement at = targetOffset > 0 ? file.findElementAt(targetOffset - 1) : null; @@ -102,8 +101,7 @@ final class ShDocumentationProvider implements DocumentationProvider { }); } - @Nullable - private static String wrapIntoHtml(@Nullable String s) { + private static @Nullable String wrapIntoHtml(@Nullable String s) { if (s == null) return null; @NonNls StringBuilder sb = new StringBuilder("
");
diff --git a/plugins/sh/core/src/com/intellij/sh/ShExplainShellIntention.java b/plugins/sh/core/src/com/intellij/sh/ShExplainShellIntention.java
index 453ec7761b9f..6d2fc97d2ae7 100644
--- a/plugins/sh/core/src/com/intellij/sh/ShExplainShellIntention.java
+++ b/plugins/sh/core/src/com/intellij/sh/ShExplainShellIntention.java
@@ -31,15 +31,13 @@ import java.util.List;
 import java.util.Set;
 
 final class ShExplainShellIntention extends BaseIntentionAction {
-  @NotNull
   @Override
-  public String getFamilyName() {
+  public @NotNull String getFamilyName() {
     return getText();
   }
 
-  @NotNull
   @Override
-  public String getText() {
+  public @NotNull String getText() {
     return ShBundle.message("sh.explain.inspection.text");
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/ShFileType.java b/plugins/sh/core/src/com/intellij/sh/ShFileType.java
index 826f38648ce0..14fe6eeabfbc 100644
--- a/plugins/sh/core/src/com/intellij/sh/ShFileType.java
+++ b/plugins/sh/core/src/com/intellij/sh/ShFileType.java
@@ -15,20 +15,17 @@ public final class ShFileType extends LanguageFileType {
   }
 
   @Override
-  @NotNull
-  public String getName() {
+  public @NotNull String getName() {
     return "Shell Script";
   }
 
   @Override
-  @NotNull
-  public String getDescription() {
+  public @NotNull String getDescription() {
     return ShBundle.message("filetype.sh.shell.script.description");
   }
 
   @Override
-  @NotNull
-  public String getDefaultExtension() {
+  public @NotNull String getDefaultExtension() {
     return "sh";
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/ShStringUtil.java b/plugins/sh/core/src/com/intellij/sh/ShStringUtil.java
index 5006b5566a58..d34a8cfa7e49 100644
--- a/plugins/sh/core/src/com/intellij/sh/ShStringUtil.java
+++ b/plugins/sh/core/src/com/intellij/sh/ShStringUtil.java
@@ -34,8 +34,7 @@ public final class ShStringUtil {
     return StringUtil.replace(name, ORIGINS, ENCODED);
   }
 
-  @NotNull
-  public static String unquote(String afterSlash) {
+  public static @NotNull String unquote(String afterSlash) {
     return StringUtil.replace(afterSlash, ENCODED, ORIGINS);
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/ShStructureViewFactory.java b/plugins/sh/core/src/com/intellij/sh/ShStructureViewFactory.java
index d9c0ff4b1657..4ecb4dd9c2a3 100644
--- a/plugins/sh/core/src/com/intellij/sh/ShStructureViewFactory.java
+++ b/plugins/sh/core/src/com/intellij/sh/ShStructureViewFactory.java
@@ -21,14 +21,12 @@ import org.jetbrains.annotations.Nullable;
 import javax.swing.*;
 
 final class ShStructureViewFactory implements PsiStructureViewFactory {
-  @Nullable
   @Override
-  public StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile psiFile) {
+  public @Nullable StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile psiFile) {
     if (!(psiFile instanceof ShFile)) return null;
     return new TreeBasedStructureViewBuilder() {
-      @NotNull
       @Override
-      public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
+      public @NotNull StructureViewModel createStructureViewModel(@Nullable Editor editor) {
         return new Model(psiFile);
       }
     };
@@ -78,9 +76,8 @@ final class ShStructureViewFactory implements PsiStructureViewFactory {
       return ((Navigatable) myElement).canNavigateToSource();
     }
 
-    @Nullable
     @Override
-    public String getName() {
+    public @Nullable String getName() {
       return myElement instanceof ShFunctionDefinition ? getFunctionName((ShFunctionDefinition) myElement) : null;
     }
 
@@ -89,9 +86,8 @@ final class ShStructureViewFactory implements PsiStructureViewFactory {
       return name == null ? ShBundle.message("sh.unnamed.element.presentable.name") : name;
     }
 
-    @NotNull
     @Override
-    public ItemPresentation getPresentation() {
+    public @NotNull ItemPresentation getPresentation() {
       return this;
     }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/ShTypedHandler.java b/plugins/sh/core/src/com/intellij/sh/ShTypedHandler.java
index fe7a4258ba61..8703aa9dd231 100644
--- a/plugins/sh/core/src/com/intellij/sh/ShTypedHandler.java
+++ b/plugins/sh/core/src/com/intellij/sh/ShTypedHandler.java
@@ -10,9 +10,8 @@ import com.intellij.sh.psi.ShFile;
 import org.jetbrains.annotations.NotNull;
 
 final class ShTypedHandler extends TypedHandlerDelegate {
-  @NotNull
   @Override
-  public Result checkAutoPopup(char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
+  public @NotNull Result checkAutoPopup(char charTyped, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
     if (!(file instanceof ShFile)) return Result.CONTINUE;
     int currentLine = editor.getCaretModel().getPrimaryCaret().getLogicalPosition().line;
     if ((currentLine == 0 && charTyped == '!') || charTyped == '/') {
diff --git a/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateForLoop.java b/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateForLoop.java
index b25753bfb5ca..67da5a99f313 100644
--- a/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateForLoop.java
+++ b/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateForLoop.java
@@ -11,9 +11,8 @@ import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
 public class ShGenerateForLoop extends ShBaseGenerateAction {
-  @NotNull
   @Override
-  protected CodeInsightActionHandler getHandler() {
+  protected @NotNull CodeInsightActionHandler getHandler() {
     return this;
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateUntilLoop.java b/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateUntilLoop.java
index c7b633460cd7..140b7297fbff 100644
--- a/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateUntilLoop.java
+++ b/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateUntilLoop.java
@@ -11,9 +11,8 @@ import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
 public class ShGenerateUntilLoop extends ShBaseGenerateAction {
-  @NotNull
   @Override
-  protected CodeInsightActionHandler getHandler() {
+  protected @NotNull CodeInsightActionHandler getHandler() {
     return this;
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateWhileLoop.java b/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateWhileLoop.java
index 2bd9b562a8f5..2baca9ed64fc 100644
--- a/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateWhileLoop.java
+++ b/plugins/sh/core/src/com/intellij/sh/actions/ShGenerateWhileLoop.java
@@ -11,9 +11,8 @@ import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
 public class ShGenerateWhileLoop extends ShBaseGenerateAction {
-  @NotNull
   @Override
-  protected CodeInsightActionHandler getHandler() {
+  protected @NotNull CodeInsightActionHandler getHandler() {
     return this;
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFindUsagesProvider.java b/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFindUsagesProvider.java
index dd95c18319fc..e50f9fad0483 100644
--- a/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFindUsagesProvider.java
+++ b/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFindUsagesProvider.java
@@ -17,9 +17,8 @@ import static com.intellij.sh.lexer.ShTokenTypes.*;
 
 public class ShFindUsagesProvider implements FindUsagesProvider {
 
-  @Nullable
   @Override
-  public WordsScanner getWordsScanner() {
+  public @Nullable WordsScanner getWordsScanner() {
     return new DefaultWordsScanner(new ShLexer(), TokenSet.create(WORD), commentTokens, literals);
   }
 
@@ -28,21 +27,18 @@ public class ShFindUsagesProvider implements FindUsagesProvider {
     return psiElement instanceof ShFunctionDefinition;
   }
 
-  @Nullable
   @Override
-  public String getHelpId(@NotNull PsiElement psiElement) {
+  public @Nullable String getHelpId(@NotNull PsiElement psiElement) {
     return null;
   }
 
-  @NotNull
   @Override
-  public String getType(@NotNull PsiElement element) {
+  public @NotNull String getType(@NotNull PsiElement element) {
     return ShBundle.message("find.usages.type.function");
   }
 
-  @NotNull
   @Override
-  public String getDescriptiveName(@NotNull PsiElement element) {
+  public @NotNull String getDescriptiveName(@NotNull PsiElement element) {
     if (element instanceof PsiNamedElement) {
       String name = ((PsiNamedElement)element).getName();
       if (name != null) return name;
@@ -50,9 +46,8 @@ public class ShFindUsagesProvider implements FindUsagesProvider {
     return element.getText();
   }
 
-  @NotNull
   @Override
-  public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
+  public @NotNull String getNodeText(@NotNull PsiElement element, boolean useFullName) {
     return element.getText();
   }
 }
\ No newline at end of file
diff --git a/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFunctionReference.java b/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFunctionReference.java
index 7852dac7c866..8cb8dab847ea 100644
--- a/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFunctionReference.java
+++ b/plugins/sh/core/src/com/intellij/sh/codeInsight/ShFunctionReference.java
@@ -17,9 +17,8 @@ public class ShFunctionReference extends PsiReferenceBase {
     super(element, TextRange.create(0, element.getTextLength()));
   }
 
-  @Nullable
   @Override
-  public PsiElement resolve() {
+  public @Nullable PsiElement resolve() {
     return CachedValuesManager.getCachedValue(myElement, new ShFunctionCachedValueProvider(myElement));
   }
 
@@ -33,8 +32,7 @@ public class ShFunctionReference extends PsiReferenceBase {
       return CachedValueProvider.Result.create(resolveInner(), myElement.getContainingFile());
     }
 
-    @Nullable
-    private PsiElement resolveInner() {
+    private @Nullable PsiElement resolveInner() {
       ShFunctionDeclarationProcessor functionProcessor = new ShFunctionDeclarationProcessor(myElement.getText());
       PsiTreeUtil.treeWalkUp(functionProcessor, myElement, myElement.getContainingFile(), ResolveState.initial());
       return functionProcessor.getFunction();
diff --git a/plugins/sh/core/src/com/intellij/sh/codeInsight/ShIncludeCommandReference.java b/plugins/sh/core/src/com/intellij/sh/codeInsight/ShIncludeCommandReference.java
index 7ddec5018eca..2a996c9661f6 100644
--- a/plugins/sh/core/src/com/intellij/sh/codeInsight/ShIncludeCommandReference.java
+++ b/plugins/sh/core/src/com/intellij/sh/codeInsight/ShIncludeCommandReference.java
@@ -18,9 +18,8 @@ public class ShIncludeCommandReference extends PsiReferenceBase {
     super(element, TextRange.create(0, element.getTextLength()));
   }
 
-  @Nullable
   @Override
-  public PsiElement resolve() {
+  public @Nullable PsiElement resolve() {
     return CachedValuesManager.getCachedValue(myElement, new ShIncludeCommandCachedValueProvider(myElement));
   }
 
@@ -34,8 +33,7 @@ public class ShIncludeCommandReference extends PsiReferenceBase {
       return Result.create(resolveInner(), myElement.getContainingFile());
     }
 
-    @Nullable
-    private PsiElement resolveInner() {
+    private @Nullable PsiElement resolveInner() {
       PsiElement parent = myElement.getParent();
       if (!(parent instanceof ShIncludeCommandImpl includeCommand)) return null;
       List commandList = includeCommand.getSimpleCommandElementList();
diff --git a/plugins/sh/core/src/com/intellij/sh/codeInsight/processor/ShFunctionDeclarationProcessor.java b/plugins/sh/core/src/com/intellij/sh/codeInsight/processor/ShFunctionDeclarationProcessor.java
index bd7c53683354..2e50ff1cd356 100644
--- a/plugins/sh/core/src/com/intellij/sh/codeInsight/processor/ShFunctionDeclarationProcessor.java
+++ b/plugins/sh/core/src/com/intellij/sh/codeInsight/processor/ShFunctionDeclarationProcessor.java
@@ -26,8 +26,7 @@ public class ShFunctionDeclarationProcessor implements PsiScopeProcessor {
     return false;
   }
 
-  @Nullable
-  public ShFunctionDefinition getFunction() {
+  public @Nullable ShFunctionDefinition getFunction() {
     return myResult;
   }
 }
\ No newline at end of file
diff --git a/plugins/sh/core/src/com/intellij/sh/codeStyle/ShCodeStylePanel.java b/plugins/sh/core/src/com/intellij/sh/codeStyle/ShCodeStylePanel.java
index 6e3b3c7c2a13..d2a7cc7e45f8 100644
--- a/plugins/sh/core/src/com/intellij/sh/codeStyle/ShCodeStylePanel.java
+++ b/plugins/sh/core/src/com/intellij/sh/codeStyle/ShCodeStylePanel.java
@@ -95,22 +95,19 @@ public class ShCodeStylePanel extends CodeStyleAbstractPanel {
     return 0;
   }
 
-  @Nullable
   @Override
-  protected EditorHighlighter createHighlighter(@NotNull EditorColorsScheme scheme) {
+  protected @Nullable EditorHighlighter createHighlighter(@NotNull EditorColorsScheme scheme) {
     SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(ShLanguage.INSTANCE, null, null);
     return HighlighterFactory.createHighlighter(highlighter, scheme);
   }
 
-  @NotNull
   @Override
-  protected FileType getFileType() {
+  protected @NotNull FileType getFileType() {
     return ShFileType.INSTANCE;
   }
 
-  @Nullable
   @Override
-  protected String getPreviewText() {
+  protected @Nullable String getPreviewText() {
     return GENERAL_CODE_SAMPLE;
   }
 
@@ -150,9 +147,8 @@ public class ShCodeStylePanel extends CodeStyleAbstractPanel {
         || isFieldModified(myShfmtPathSelector, ShSettings.getShfmtPath());
   }
 
-  @Nullable
   @Override
-  public JComponent getPanel() {
+  public @Nullable JComponent getPanel() {
     return myPanel;
   }
 
@@ -187,7 +183,7 @@ public class ShCodeStylePanel extends CodeStyleAbstractPanel {
     return !browseButton.getText().equals(value);
   }
 
-  @NonNls private static final String GENERAL_CODE_SAMPLE = """
+  private static final @NonNls String GENERAL_CODE_SAMPLE = """
     #!/usr/bin/env sh
 
     function foo() {
diff --git a/plugins/sh/core/src/com/intellij/sh/codeStyle/ShLanguageCodeStyleSettingsProvider.java b/plugins/sh/core/src/com/intellij/sh/codeStyle/ShLanguageCodeStyleSettingsProvider.java
index 23a762f0897d..e6556c00021a 100644
--- a/plugins/sh/core/src/com/intellij/sh/codeStyle/ShLanguageCodeStyleSettingsProvider.java
+++ b/plugins/sh/core/src/com/intellij/sh/codeStyle/ShLanguageCodeStyleSettingsProvider.java
@@ -11,9 +11,8 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class ShLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettingsProvider {
-  @NotNull
   @Override
-  public CodeStyleConfigurable createConfigurable(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings) {
+  public @NotNull CodeStyleConfigurable createConfigurable(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings) {
     return new CodeStyleAbstractConfigurable(settings, modelSettings, getLanguage().getID()) {
       @Override
       protected @NotNull CodeStyleAbstractPanel createPanel(final @NotNull CodeStyleSettings settings) {
@@ -30,28 +29,23 @@ public class ShLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettin
     }
   }
 
-  @NotNull
   @Override
-  public String getCodeSample(@NotNull SettingsType settingsType) {
+  public @NotNull String getCodeSample(@NotNull SettingsType settingsType) {
     return "";
   }
 
-  @NotNull
   @Override
-  public Language getLanguage() {
+  public @NotNull Language getLanguage() {
     return ShLanguage.INSTANCE;
   }
 
-  @NonNls
-  @NotNull
   @Override
-  public String getExternalLanguageId() {
+  public @NonNls @NotNull String getExternalLanguageId() {
     return "shell";
   }
 
-  @Nullable
   @Override
-  public CustomCodeStyleSettings createCustomSettings(@NotNull CodeStyleSettings settings) {
+  public @Nullable CustomCodeStyleSettings createCustomSettings(@NotNull CodeStyleSettings settings) {
     return new ShCodeStyleSettings(settings);
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/completion/ShCommandCompletionContributor.java b/plugins/sh/core/src/com/intellij/sh/completion/ShCommandCompletionContributor.java
index 1c88b6640af2..bfa1bcd3cc17 100644
--- a/plugins/sh/core/src/com/intellij/sh/completion/ShCommandCompletionContributor.java
+++ b/plugins/sh/core/src/com/intellij/sh/completion/ShCommandCompletionContributor.java
@@ -16,7 +16,6 @@ import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.sh.ShLanguage;
 import com.intellij.sh.lexer.ShTokenTypes;
 import com.intellij.sh.psi.ShCommandsList;
-import com.intellij.sh.psi.ShFile;
 import com.intellij.ui.IconManager;
 import com.intellij.util.ProcessingContext;
 import com.intellij.util.SmartList;
@@ -92,8 +91,7 @@ public class ShCommandCompletionContributor extends CompletionContributor implem
         return o instanceof IElementType ? kw2str(((IElementType) o)) : null;
       }
 
-      @Nullable
-      private static String kw2str(IElementType o) {
+      private static @Nullable String kw2str(IElementType o) {
         return ShTokenTypes.HUMAN_READABLE_KEYWORDS_WITHOUT_TEMPLATES.contains(o) ? o.toString() : null;
       }
     };
@@ -108,7 +106,7 @@ public class ShCommandCompletionContributor extends CompletionContributor implem
         insideCondition(), insideComment()));
   }
 
-  @NonNls private static final List BUILTIN =
+  private static final @NonNls List BUILTIN =
     Arrays.asList("alias", "bg", "bind", "break", "builtin", "caller", "cd", "command", "compgen", "complete", "continue", "declare",
                   "dirs", "disown", "echo", "enable", "eval", "exec", "exit", "export", "false", "fc", "fg", "getopts", "hash", "help", "history",
                   "jobs", "kill", "let", "local", "logout", "popd", "printf", "pushd", "pwd", "read", "readonly", "return", "set", "shift", "shopt",
diff --git a/plugins/sh/core/src/com/intellij/sh/completion/ShFilePathCompletionContributor.java b/plugins/sh/core/src/com/intellij/sh/completion/ShFilePathCompletionContributor.java
index 0d7e116806b5..0f4bbd333123 100644
--- a/plugins/sh/core/src/com/intellij/sh/completion/ShFilePathCompletionContributor.java
+++ b/plugins/sh/core/src/com/intellij/sh/completion/ShFilePathCompletionContributor.java
@@ -113,8 +113,7 @@ public class ShFilePathCompletionContributor extends CompletionContributor imple
     });
   }
 
-  @NotNull
-  private static LookupElement createFileLookupElement(@NotNull File file) {
+  private static @NotNull LookupElement createFileLookupElement(@NotNull File file) {
     String name = file.getName();
     boolean isDirectory = file.isDirectory();
     return LookupElementBuilder.create(file, quote(name))
@@ -122,8 +121,7 @@ public class ShFilePathCompletionContributor extends CompletionContributor imple
         .withInsertHandler(FILE_INSERT_HANDLER);
   }
 
-  @Nullable
-  private static String getTextWithEnvVarReplacement(@NotNull CompletionParameters parameters) {
+  private static @Nullable String getTextWithEnvVarReplacement(@NotNull CompletionParameters parameters) {
     PsiElement original = parameters.getOriginalPosition();
     if (original == null) return null;
 
@@ -143,8 +141,7 @@ public class ShFilePathCompletionContributor extends CompletionContributor imple
         : originalText;
   }
 
-  @Nullable
-  private static PsiElement getNearestVarIfExist(@NotNull PsiFile file, int offset) {
+  private static @Nullable PsiElement getNearestVarIfExist(@NotNull PsiFile file, int offset) {
     PsiElement e = file.findElementAt(offset);
     if (!(e instanceof LeafPsiElement leaf)) return null;
     if (leaf.getElementType() == ShTypes.VAR) return leaf;
@@ -165,8 +162,7 @@ public class ShFilePathCompletionContributor extends CompletionContributor imple
         children[2].getElementType() == ShTypes.CLOSE_QUOTE;
   }
 
-  @NotNull
-  private static String variableText(PsiElement e) {
+  private static @NotNull String variableText(PsiElement e) {
     String variable = e.getText();
     int index = variable.indexOf("$");
     if (index + 1 <= 0) return variable;
diff --git a/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionContributor.java b/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionContributor.java
index 7f5140b8cd87..64417152f3e3 100644
--- a/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionContributor.java
+++ b/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionContributor.java
@@ -24,16 +24,14 @@ public class ShKeywordCompletionContributor extends CompletionContributor implem
         "path exists", "directory exists", "file readable", "file writable", "file executable", "file equals", "file newer", "file older"));
   }
 
-  @NotNull
-  private static PsiElementPattern.Capture keywordElementPattern() {
+  private static @NotNull PsiElementPattern.Capture keywordElementPattern() {
     return psiElement().andNot(psiElement().andOr(insideForClause(), insideIfDeclaration(), insideWhileDeclaration(),
         insideUntilDeclaration(), insideFunctionDefinition(), insideSelectDeclaration(), insideCaseDeclaration(),
         insideCondition(), insideArithmeticExpansions(), insideOldArithmeticExpansions(), insideParameterExpansion(),
         insideCommandSubstitution(), insideSubshellCommand(), insideRawString(), insideString(), insideComment()));
   }
 
-  @NotNull
-  private static PsiElementPattern.Capture elifElementPattern() {
+  private static @NotNull PsiElementPattern.Capture elifElementPattern() {
     return insideThenOrElse().andNot(psiElement().andOr(insideRawString(), insideString(), insideComment()));
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionProvider.java b/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionProvider.java
index ace616df9cda..55c9e0c0ffe7 100644
--- a/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionProvider.java
+++ b/plugins/sh/core/src/com/intellij/sh/completion/ShKeywordCompletionProvider.java
@@ -23,8 +23,7 @@ class ShKeywordCompletionProvider extends CompletionProvider ACCEPTABLE_SHELLS = Arrays.asList("/usr/bin/env bash",
+  private static final @NonNls List ACCEPTABLE_SHELLS = Arrays.asList("/usr/bin/env bash",
                                                                               "/usr/bin/env sh",
                                                                               "/usr/bin/env zsh",
                                                                               "/usr/bin/env csh",
                                                                               "/usr/bin/env ksh",
                                                                               "/usr/bin/env tcsh");
 
-  @NonNls private static final CompletionProvider SHEBANG_COMPLETION_PROVIDER = new CompletionProvider<>() {
+  private static final @NonNls CompletionProvider SHEBANG_COMPLETION_PROVIDER = new CompletionProvider<>() {
     @Override
     protected void addCompletions(@NotNull CompletionParameters parameters,
                                   @NotNull ProcessingContext context,
diff --git a/plugins/sh/core/src/com/intellij/sh/editor/ShCommenter.java b/plugins/sh/core/src/com/intellij/sh/editor/ShCommenter.java
index 1058677e5698..71dda496b6cf 100644
--- a/plugins/sh/core/src/com/intellij/sh/editor/ShCommenter.java
+++ b/plugins/sh/core/src/com/intellij/sh/editor/ShCommenter.java
@@ -35,38 +35,32 @@ public class ShCommenter implements CodeDocumentationAwareCommenter {
   }
 
   @Override
-  @Nullable
-  public IElementType getLineCommentTokenType() {
+  public @Nullable IElementType getLineCommentTokenType() {
     return COMMENT;
   }
 
   @Override
-  @Nullable
-  public IElementType getBlockCommentTokenType() {
+  public @Nullable IElementType getBlockCommentTokenType() {
     return null;
   }
 
   @Override
-  @Nullable
-  public IElementType getDocumentationCommentTokenType() {
+  public @Nullable IElementType getDocumentationCommentTokenType() {
     return null;
   }
 
   @Override
-  @Nullable
-  public String getDocumentationCommentPrefix() {
+  public @Nullable String getDocumentationCommentPrefix() {
     return "#";
   }
 
   @Override
-  @Nullable
-  public String getDocumentationCommentLinePrefix() {
+  public @Nullable String getDocumentationCommentLinePrefix() {
     return "#";
   }
 
   @Override
-  @Nullable
-  public String getDocumentationCommentSuffix() {
+  public @Nullable String getDocumentationCommentSuffix() {
     return null;
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/formatter/ShExternalFormatter.java b/plugins/sh/core/src/com/intellij/sh/formatter/ShExternalFormatter.java
index 9e0c226c6cc2..a4ffb3dbe033 100644
--- a/plugins/sh/core/src/com/intellij/sh/formatter/ShExternalFormatter.java
+++ b/plugins/sh/core/src/com/intellij/sh/formatter/ShExternalFormatter.java
@@ -33,7 +33,7 @@ import static com.intellij.sh.ShBundle.message;
 import static com.intellij.sh.ShNotification.NOTIFICATION_GROUP_ID;
 
 public final class ShExternalFormatter extends AsyncDocumentFormattingService {
-  @NonNls private static final List KNOWN_SHELLS = Arrays.asList("bash", "posix", "mksh");
+  private static final @NonNls List KNOWN_SHELLS = Arrays.asList("bash", "posix", "mksh");
 
   private static final Set FEATURES = EnumSet.noneOf(Feature.class);
 
diff --git a/plugins/sh/core/src/com/intellij/sh/formatter/ShLineIndentProvider.java b/plugins/sh/core/src/com/intellij/sh/formatter/ShLineIndentProvider.java
index 797a3ff338ef..3f888b85d053 100644
--- a/plugins/sh/core/src/com/intellij/sh/formatter/ShLineIndentProvider.java
+++ b/plugins/sh/core/src/com/intellij/sh/formatter/ShLineIndentProvider.java
@@ -18,9 +18,8 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class ShLineIndentProvider implements LineIndentProvider {
-  @Nullable
   @Override
-  public String getLineIndent(@NotNull Project project, @NotNull Editor editor, @Nullable Language language, int offset) {
+  public @Nullable String getLineIndent(@NotNull Project project, @NotNull Editor editor, @Nullable Language language, int offset) {
     if (offset > 0) {
       ShSemanticEditorPosition position = getPosition(editor, offset - 1);
       if (position.isAt(ShTypes.LINEFEED) || position.isAt(ShTokenTypes.WHITESPACE)) {
@@ -65,8 +64,7 @@ public class ShLineIndentProvider implements LineIndentProvider {
     }
   }
 
-  @NotNull
-  private static String getIndentString(@NotNull Editor editor, int offset, boolean shouldExpand) {
+  private static @NotNull String getIndentString(@NotNull Editor editor, int offset, boolean shouldExpand) {
     CodeStyleSettings settings = CodeStyle.getSettings(editor);
     CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(ShFileType.INSTANCE);
     CharSequence docChars = editor.getDocument().getCharsSequence();
diff --git a/plugins/sh/core/src/com/intellij/sh/formatter/ShSemanticEditorPosition.java b/plugins/sh/core/src/com/intellij/sh/formatter/ShSemanticEditorPosition.java
index 15a0dd51b2d1..65bb3cef7208 100644
--- a/plugins/sh/core/src/com/intellij/sh/formatter/ShSemanticEditorPosition.java
+++ b/plugins/sh/core/src/com/intellij/sh/formatter/ShSemanticEditorPosition.java
@@ -49,8 +49,7 @@ final class ShSemanticEditorPosition {
     return !myIterator.atEnd() ? myIterator.getStart() : -1;
   }
 
-  @NotNull
-  static ShSemanticEditorPosition createEditorPosition(@NotNull Editor editor, int offset) {
+  static @NotNull ShSemanticEditorPosition createEditorPosition(@NotNull Editor editor, int offset) {
     return new ShSemanticEditorPosition(editor, offset);
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java b/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java
index 8274e2f56235..365008f29ce7 100644
--- a/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java
+++ b/plugins/sh/core/src/com/intellij/sh/formatter/ShShfmtFormatterUtil.java
@@ -264,8 +264,7 @@ public final class ShShfmtFormatterUtil {
     return null;
   }
 
-  @NotNull
-  private static String getShfmtDistributionLink() {
+  private static @NotNull String getShfmtDistributionLink() {
     StringBuilder baseUrl = new StringBuilder("https://github.com/mvdan/sh/releases/download/")
         .append(SHFMT_VERSION)
         .append('/')
diff --git a/plugins/sh/core/src/com/intellij/sh/highlighter/ShColorPage.java b/plugins/sh/core/src/com/intellij/sh/highlighter/ShColorPage.java
index 92e068e1436c..fb8bef9e6863 100644
--- a/plugins/sh/core/src/com/intellij/sh/highlighter/ShColorPage.java
+++ b/plugins/sh/core/src/com/intellij/sh/highlighter/ShColorPage.java
@@ -47,7 +47,7 @@ public class ShColorPage implements ColorSettingsPage {
       new AttributesDescriptor(ShBundle.message("sh.color.function.declaration"), ShHighlighterColors.FUNCTION_DECLARATION)
   };
 
-  @NonNls private static final HashMap TAG_DESCRIPTOR_MAP = new HashMap<>();
+  private static final @NonNls HashMap TAG_DESCRIPTOR_MAP = new HashMap<>();
   static {
     TAG_DESCRIPTOR_MAP.put("var", ShHighlighterColors.VARIABLE_DECLARATION);
     TAG_DESCRIPTOR_MAP.put("composed_var", ShHighlighterColors.COMPOSED_VARIABLE);
@@ -56,27 +56,23 @@ public class ShColorPage implements ColorSettingsPage {
     TAG_DESCRIPTOR_MAP.put("subshell", ShHighlighterColors.SUBSHELL_COMMAND);
   }
 
-  @NotNull
   @Override
-  public String getDisplayName() {
+  public @NotNull String getDisplayName() {
     return ShLanguage.INSTANCE.getID();
   }
 
-  @Nullable
   @Override
-  public Icon getIcon() {
+  public @Nullable Icon getIcon() {
     return ShFileType.INSTANCE.getIcon();
   }
 
-  @NotNull
   @Override
-  public SyntaxHighlighter getHighlighter() {
+  public @NotNull SyntaxHighlighter getHighlighter() {
     return SyntaxHighlighterFactory.getSyntaxHighlighter(ShLanguage.INSTANCE, null, null);
   }
 
-  @Nullable
   @Override
-  public Map getAdditionalHighlightingTagToDescriptorMap() {
+  public @Nullable Map getAdditionalHighlightingTagToDescriptorMap() {
     return TAG_DESCRIPTOR_MAP;
   }
 
@@ -90,9 +86,8 @@ public class ShColorPage implements ColorSettingsPage {
     return ColorDescriptor.EMPTY_ARRAY;
   }
 
-  @NotNull
   @Override
-  public String getDemoText() {
+  public @NotNull String getDemoText() {
     return
       """
         #!/usr/bin/env sh
diff --git a/plugins/sh/core/src/com/intellij/sh/highlighter/ShSyntaxHighlighter.java b/plugins/sh/core/src/com/intellij/sh/highlighter/ShSyntaxHighlighter.java
index 894e323cc922..64cca9d7fc4a 100644
--- a/plugins/sh/core/src/com/intellij/sh/highlighter/ShSyntaxHighlighter.java
+++ b/plugins/sh/core/src/com/intellij/sh/highlighter/ShSyntaxHighlighter.java
@@ -61,8 +61,7 @@ public class ShSyntaxHighlighter extends SyntaxHighlighterBase {
   }
 
   @Override
-  @NotNull
-  public Lexer getHighlightingLexer() {
+  public @NotNull Lexer getHighlightingLexer() {
     return new ShLexer();
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java b/plugins/sh/core/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java
index 6e847b4932dd..ca798496b38e 100644
--- a/plugins/sh/core/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java
+++ b/plugins/sh/core/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java
@@ -19,8 +19,7 @@ public final class ShTextOccurrencesUtil {
   private ShTextOccurrencesUtil() {
   }
 
-  @Nullable
-  public static TextRange findTextRangeOfIdentifierAtCaret(@NotNull Editor editor) {
+  public static @Nullable TextRange findTextRangeOfIdentifierAtCaret(@NotNull Editor editor) {
     Caret caret = editor.getCaretModel().getPrimaryCaret();
     if (caret.hasSelection()) {
       TextRange textRange = TextRange.create(caret.getSelectionStart(), caret.getSelectionEnd());
@@ -36,10 +35,9 @@ public final class ShTextOccurrencesUtil {
     return ch == '_' || Character.isLetterOrDigit(ch);
   }
 
-  @NotNull
-  public static Collection findAllOccurrences(@NotNull CharSequence documentText,
-                                                         @NotNull CharSequence textToFind,
-                                                         boolean matchExactWordsOnly) {
+  public static @NotNull Collection findAllOccurrences(@NotNull CharSequence documentText,
+                                                                  @NotNull CharSequence textToFind,
+                                                                  boolean matchExactWordsOnly) {
     CollectConsumer consumer = new CollectConsumer<>();
     consumeAllOccurrences(documentText, textToFind, matchExactWordsOnly, consumer);
     return consumer.getResult();
diff --git a/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyBlockElementType.java b/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyBlockElementType.java
index 532724b0ad53..279d8b3a5743 100644
--- a/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyBlockElementType.java
+++ b/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyBlockElementType.java
@@ -19,9 +19,8 @@ public class ShLazyBlockElementType extends IReparseableElementType implements I
     super(debugName, ShLanguage.INSTANCE);
   }
 
-  @NotNull
   @Override
-  public ASTNode createCompositeNode() {
+  public @NotNull ASTNode createCompositeNode() {
     return createNode(null);
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyDoBlockElementType.java b/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyDoBlockElementType.java
index 8fd629f03306..ccdb30ce8818 100644
--- a/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyDoBlockElementType.java
+++ b/plugins/sh/core/src/com/intellij/sh/lexer/ShLazyDoBlockElementType.java
@@ -18,15 +18,13 @@ public class ShLazyDoBlockElementType extends IReparseableElementType implements
     super(debugName, ShLanguage.INSTANCE);
   }
 
-  @NotNull
   @Override
-  public ASTNode createCompositeNode() {
+  public @NotNull ASTNode createCompositeNode() {
     return createNode(null);
   }
 
-  @NotNull
   @Override
-  public ASTNode createNode(CharSequence text) {
+  public @NotNull ASTNode createNode(CharSequence text) {
     return new ShDoBlockImpl(this, text);
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/parser/ShParserDefinition.java b/plugins/sh/core/src/com/intellij/sh/parser/ShParserDefinition.java
index e99b61c65a86..489512cef70d 100644
--- a/plugins/sh/core/src/com/intellij/sh/parser/ShParserDefinition.java
+++ b/plugins/sh/core/src/com/intellij/sh/parser/ShParserDefinition.java
@@ -19,9 +19,8 @@ import com.intellij.sh.psi.ShFileElementType;
 import org.jetbrains.annotations.NotNull;
 
 public class ShParserDefinition implements ParserDefinition, ShTokenTypes {
-  @NotNull
   @Override
-  public Lexer createLexer(Project project) {
+  public @NotNull Lexer createLexer(Project project) {
     return new ShLexer();
   }
 
@@ -35,27 +34,23 @@ public class ShParserDefinition implements ParserDefinition, ShTokenTypes {
     return ShFileElementType.INSTANCE;
   }
 
-  @NotNull
   @Override
-  public TokenSet getWhitespaceTokens() {
+  public @NotNull TokenSet getWhitespaceTokens() {
     return whitespaceTokens;
   }
 
-  @NotNull
   @Override
-  public TokenSet getCommentTokens() {
+  public @NotNull TokenSet getCommentTokens() {
     return commentTokens;
   }
 
-  @NotNull
   @Override
-  public TokenSet getStringLiteralElements() {
+  public @NotNull TokenSet getStringLiteralElements() {
     return stringLiterals;
   }
 
-  @NotNull
   @Override
-  public PsiElement createElement(ASTNode astNode) {
+  public @NotNull PsiElement createElement(ASTNode astNode) {
     return ShTypes.Factory.createElement(astNode);
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/parser/ShShebangParserUtil.java b/plugins/sh/core/src/com/intellij/sh/parser/ShShebangParserUtil.java
index 3ca465ca5fa8..8adfacc04501 100644
--- a/plugins/sh/core/src/com/intellij/sh/parser/ShShebangParserUtil.java
+++ b/plugins/sh/core/src/com/intellij/sh/parser/ShShebangParserUtil.java
@@ -19,14 +19,13 @@ import java.util.List;
 import java.util.Locale;
 
 public final class ShShebangParserUtil {
-  @NonNls private static final List KNOWN_EXTENSIONS = Arrays.asList("exe", "bat", "cmd");
+  private static final @NonNls List KNOWN_EXTENSIONS = Arrays.asList("exe", "bat", "cmd");
   private static final String PREFIX = "#!";
 
   private ShShebangParserUtil() {
   }
 
-  @Nullable
-  public static String getShebangExecutable(@NotNull ShFile file) {
+  public static @Nullable String getShebangExecutable(@NotNull ShFile file) {
     VirtualFile virtualFile = file.getVirtualFile();
     if (virtualFile != null && virtualFile.exists()) {
       ASTNode shebang = file.getNode().findChildByType(ShTypes.SHEBANG);
@@ -38,18 +37,16 @@ public final class ShShebangParserUtil {
     return null;
   }
 
-  @NotNull
-  public static @NlsSafe String getInterpreter(@NotNull ShFile file,
-                                               @NotNull List<@NlsSafe String> knownShells,
-                                               @NlsSafe @NotNull String defaultShell) {
+  public static @NotNull @NlsSafe String getInterpreter(@NotNull ShFile file,
+                                                        @NotNull List<@NlsSafe String> knownShells,
+                                                        @NlsSafe @NotNull String defaultShell) {
     String shebang = ApplicationManager.getApplication().isDispatchThread() ? file.findShebang()
                                                                             : ReadAction.compute(() -> file.findShebang());
     String detectedInterpreter = shebang != null ? detectInterpreter(shebang) : null;
     return detectedInterpreter != null && knownShells.contains(detectedInterpreter) ? detectedInterpreter : defaultShell;
   }
 
-  @Nullable
-  public static String detectInterpreter(@Nullable String shebang) {
+  public static @Nullable String detectInterpreter(@Nullable String shebang) {
     if (shebang == null || !shebang.startsWith(PREFIX)) return null;
 
     String interpreterPath = getInterpreterPath(shebang.substring(PREFIX.length()).trim());
@@ -58,8 +55,7 @@ public final class ShShebangParserUtil {
     return trimKnownExt(PathUtil.getFileName(lowerCasePath));
   }
 
-  @NotNull
-  private static String getInterpreterPath(@NotNull String shebang) {
+  private static @NotNull String getInterpreterPath(@NotNull String shebang) {
     int index = shebang.indexOf(" ");
     @NonNls String possiblePath = index < 0 ? shebang : shebang.substring(0, index);
     if (!possiblePath.equals("/usr/bin/env")) return possiblePath;
@@ -69,8 +65,7 @@ public final class ShShebangParserUtil {
     return index < 0 ? interpreterPath : interpreterPath.substring(0, index);
   }
 
-  @NotNull
-  private static String trimKnownExt(@NotNull String name) {
+  private static @NotNull String trimKnownExt(@NotNull String name) {
     String ext = PathUtil.getFileExtension(name);
     return ext != null && KNOWN_EXTENSIONS.contains(ext) ? name.substring(0, name.length() - ext.length() - 1) : name;
   }
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/ShFile.java b/plugins/sh/core/src/com/intellij/sh/psi/ShFile.java
index 67273e9303ac..d46526f7106d 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/ShFile.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/ShFile.java
@@ -21,9 +21,8 @@ public class ShFile extends PsiFileBase {
     super(viewProvider, ShLanguage.INSTANCE);
   }
 
-  @NotNull
   @Override
-  public FileType getFileType() {
+  public @NotNull FileType getFileType() {
     return ShFileType.INSTANCE;
   }
 
@@ -35,13 +34,11 @@ public class ShFile extends PsiFileBase {
     return ResolveUtil.processChildren(this, processor, state, lastParent, place);
   }
 
-  @Nullable
-  public String findShebang() {
+  public @Nullable String findShebang() {
     return CachedValuesManager.getCachedValue(this, () -> CachedValueProvider.Result.create(findShebangInner(), this));
   }
 
-  @Nullable
-  private String findShebangInner() {
+  private @Nullable String findShebangInner() {
     ASTNode shebang = getNode().findChildByType(ShTypes.SHEBANG);
     return shebang != null ? shebang.getText() : null;
   }
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentCommandMixin.java b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentCommandMixin.java
index 0164eec66427..7bcdaa75c827 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentCommandMixin.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentCommandMixin.java
@@ -20,8 +20,7 @@ abstract class ShAssignmentCommandMixin extends ShCommandImpl implements ShAssig
   }
 
   @Override
-  @Nullable
-  public String getName() {
+  public @Nullable String getName() {
     PsiElement nameIdentifier = getNameIdentifier();
     return nameIdentifier == null ? null : nameIdentifier.getText();
   }
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentExpressionMixin.java b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentExpressionMixin.java
index b1020817a7c1..614206000877 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentExpressionMixin.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShAssignmentExpressionMixin.java
@@ -30,8 +30,7 @@ abstract class ShAssignmentExpressionMixin extends ShBinaryExpressionImpl implem
   }
 
   @Override
-  @Nullable
-  public String getName() {
+  public @Nullable String getName() {
     PsiElement nameIdentifier = getNameIdentifier();
     return nameIdentifier == null ? null : nameIdentifier.getText();
   }
@@ -43,8 +42,7 @@ abstract class ShAssignmentExpressionMixin extends ShBinaryExpressionImpl implem
    * @return the name identifier of the assignment expression, if available
    */
   @Override
-  @Nullable
-  public PsiElement getNameIdentifier() {
+  public @Nullable PsiElement getNameIdentifier() {
     PsiElement left = getLeft();
     if (!(left instanceof ShLiteralExpression)) return null;
     PsiElement first = left.getFirstChild();
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShCompositeElementImpl.java b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShCompositeElementImpl.java
index 10cd57725a51..ecbe4b46e174 100755
--- a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShCompositeElementImpl.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShCompositeElementImpl.java
@@ -67,21 +67,18 @@ public class ShCompositeElementImpl extends ASTWrapperPsiElement implements ShCo
   public ItemPresentation getPresentation() {
     final String text = UsageViewUtil.createNodeText(this);
     return new ItemPresentation() {
-      @NotNull
       @Override
-      public String getPresentableText() {
+      public @NotNull String getPresentableText() {
         return text;
       }
 
-      @NotNull
       @Override
-      public String getLocationString() {
+      public @NotNull String getLocationString() {
         return getContainingFile().getName();
       }
 
-      @Nullable
       @Override
-      public Icon getIcon(boolean b) {
+      public @Nullable Icon getIcon(boolean b) {
         return ShCompositeElementImpl.this.getIcon(0);
       }
     };
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyBlockImpl.java b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyBlockImpl.java
index a9bcc922636b..f03177b24bb3 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyBlockImpl.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyBlockImpl.java
@@ -18,13 +18,11 @@ public class ShLazyBlockImpl extends ShLazyParseablePsiElement {
     super(node.getElementType(), node.getText());
   }
 
-  @NotNull
-  public PsiElement getLeftCurly() {
+  public @NotNull PsiElement getLeftCurly() {
     return findNotNullChildByType(LEFT_CURLY);
   }
 
-  @Nullable
-  public PsiElement getRightCurly() {
+  public @Nullable PsiElement getRightCurly() {
     return findChildByElementType(RIGHT_CURLY);
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyDoBlockImpl.java b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyDoBlockImpl.java
index ebcc04b3eb41..4b8ceb0a83d9 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyDoBlockImpl.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/impl/ShLazyDoBlockImpl.java
@@ -18,13 +18,11 @@ public class ShLazyDoBlockImpl extends ShLazyParseablePsiElement {
     super(node.getElementType(), node.getText());
   }
 
-  @NotNull
-  public PsiElement getDo() {
+  public @NotNull PsiElement getDo() {
     return findNotNullChildByType(DO);
   }
 
-  @Nullable
-  public PsiElement getDone() {
+  public @Nullable PsiElement getDone() {
     return findChildByElementType(DONE);
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShElementGenerator.java b/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShElementGenerator.java
index 5f0779d269dd..cb42157f8fde 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShElementGenerator.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShElementGenerator.java
@@ -12,16 +12,14 @@ import com.intellij.sh.psi.ShLiteral;
 import org.jetbrains.annotations.NotNull;
 
 public final class ShElementGenerator {
-  @NotNull
-  public static ShLiteral createLiteral(@NotNull Project project, @NotNull String command) {
+  public static @NotNull ShLiteral createLiteral(@NotNull Project project, @NotNull String command) {
     PsiFile file = createTempFile(project, command);
     ShLiteral literal = PsiTreeUtil.findChildOfType(file, ShLiteral.class);
     assert literal != null;
     return literal;
   }
 
-  @NotNull
-  public static PsiElement createFunctionIdentifier(@NotNull Project project, @NotNull String functionName) {
+  public static @NotNull PsiElement createFunctionIdentifier(@NotNull Project project, @NotNull String functionName) {
     PsiFile file = createTempFile(project, functionName + "() {  }");
     ShFunctionDefinition functionDefinition = PsiTreeUtil.findChildOfType(file, ShFunctionDefinition.class);
     assert functionDefinition != null;
@@ -30,8 +28,7 @@ public final class ShElementGenerator {
     return word;
   }
 
-  @NotNull
-  private static PsiFile createTempFile(@NotNull Project project, @NotNull String contents) {
+  private static @NotNull PsiFile createTempFile(@NotNull Project project, @NotNull String contents) {
     return PsiFileFactory.getInstance(project).createFileFromText("dummy_file." + ShFileType.INSTANCE.getDefaultExtension(),
                                                                   ShFileType.INSTANCE, contents);
   }
diff --git a/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShLiteralManipulator.java b/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShLiteralManipulator.java
index 0800123eb8c5..cd95810d26d9 100644
--- a/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShLiteralManipulator.java
+++ b/plugins/sh/core/src/com/intellij/sh/psi/manipulator/ShLiteralManipulator.java
@@ -10,9 +10,8 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class ShLiteralManipulator extends AbstractElementManipulator {
-  @Nullable
   @Override
-  public ShLiteral handleContentChange(@NotNull ShLiteral element, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
+  public @Nullable ShLiteral handleContentChange(@NotNull ShLiteral element, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
     ASTNode oldNode = element.getNode();
     ShLiteral newElement = ShElementGenerator.createLiteral(element.getProject(), newContent);
     oldNode.getTreeParent().replaceChild(oldNode, newElement.getNode());
diff --git a/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesHandler.java b/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesHandler.java
index 4f12e1f1af52..c58951e19e92 100644
--- a/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesHandler.java
+++ b/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesHandler.java
@@ -33,7 +33,7 @@ final class ShRenameAllOccurrencesHandler extends EditorActionHandler {
   }
 
   @Override
-  public void doExecute(@NotNull final Editor editor, @Nullable Caret c, DataContext dataContext) {
+  public void doExecute(final @NotNull Editor editor, @Nullable Caret c, DataContext dataContext) {
     Caret caret = editor.getCaretModel().getPrimaryCaret();
     SelectionModel selectionModel = editor.getSelectionModel();
     boolean hasSelection = caret.hasSelection();
@@ -62,8 +62,7 @@ final class ShRenameAllOccurrencesHandler extends EditorActionHandler {
     }
   }
 
-  @NotNull
-  static RegistryValue getMaxInplaceRenameSegmentsRegistryValue() {
+  static @NotNull RegistryValue getMaxInplaceRenameSegmentsRegistryValue() {
     return Registry.get("inplace.rename.segments.limit");
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesIntention.java b/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesIntention.java
index 8dc0c5de3dda..95663d3891f2 100644
--- a/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesIntention.java
+++ b/plugins/sh/core/src/com/intellij/sh/rename/ShRenameAllOccurrencesIntention.java
@@ -17,15 +17,13 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class ShRenameAllOccurrencesIntention extends BaseIntentionAction implements ShortcutProvider, HighPriorityAction {
-  @NotNull
   @Override
-  public String getFamilyName() {
+  public @NotNull String getFamilyName() {
     return getText();
   }
 
-  @NotNull
   @Override
-  public String getText() {
+  public @NotNull String getText() {
     return ShBundle.message("sh.rename.all.occurrences");
   }
 
@@ -47,9 +45,8 @@ public class ShRenameAllOccurrencesIntention extends BaseIntentionAction impleme
     }
   }
 
-  @Nullable
   @Override
-  public ShortcutSet getShortcut() {
+  public @Nullable ShortcutSet getShortcut() {
     return CommonShortcuts.getRename();
   }
 }
diff --git a/plugins/sh/core/src/com/intellij/sh/rename/ShRenameDialog.java b/plugins/sh/core/src/com/intellij/sh/rename/ShRenameDialog.java
index 71ed2e5babc7..1c32f195c002 100644
--- a/plugins/sh/core/src/com/intellij/sh/rename/ShRenameDialog.java
+++ b/plugins/sh/core/src/com/intellij/sh/rename/ShRenameDialog.java
@@ -44,15 +44,13 @@ class ShRenameDialog extends RefactoringDialog {
     myRenamer.renameTo(getNewName());
   }
 
-  @Nullable
   @Override
-  public JComponent getPreferredFocusedComponent() {
+  public @Nullable JComponent getPreferredFocusedComponent() {
     return myNameSuggestionsField.getFocusableComponent();
   }
 
-  @Nullable
   @Override
-  protected JComponent createNorthPanel() {
+  protected @Nullable JComponent createNorthPanel() {
     JPanel panel = new JPanel(new GridBagLayout());
     panel.add(myNameLabel, new GridBagConstraints(
       0, 0,
@@ -75,9 +73,8 @@ class ShRenameDialog extends RefactoringDialog {
     return panel;
   }
 
-  @Nullable
   @Override
-  protected JComponent createCenterPanel() {
+  protected @Nullable JComponent createCenterPanel() {
     return null;
   }
 
@@ -91,8 +88,7 @@ class ShRenameDialog extends RefactoringDialog {
     return false;
   }
 
-  @NotNull
-  private String getNewName() {
+  private @NotNull String getNewName() {
     return myNameSuggestionsField.getEnteredName().trim();
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/rename/ShTextRenameRefactoring.java b/plugins/sh/core/src/com/intellij/sh/rename/ShTextRenameRefactoring.java
index 8a421e8cd58f..b0ac4618f3a6 100644
--- a/plugins/sh/core/src/com/intellij/sh/rename/ShTextRenameRefactoring.java
+++ b/plugins/sh/core/src/com/intellij/sh/rename/ShTextRenameRefactoring.java
@@ -28,8 +28,8 @@ import org.jetbrains.annotations.Nullable;
 import java.util.*;
 
 final class ShTextRenameRefactoring {
-  @NonNls private static final String PRIMARY_VARIABLE_NAME = "PrimaryVariable";
-  @NonNls private static final String OTHER_VARIABLE_NAME = "OtherVariable";
+  private static final @NonNls String PRIMARY_VARIABLE_NAME = "PrimaryVariable";
+  private static final @NonNls String OTHER_VARIABLE_NAME = "OtherVariable";
 
   private final Editor myEditor;
   private final Project myProject;
@@ -54,12 +54,11 @@ final class ShTextRenameRefactoring {
     myOccurrenceRangeAtCaret = occurrenceRangeAtCaret;
   }
 
-  @Nullable
-  static ShTextRenameRefactoring create(@NotNull Editor editor,
-                                        @NotNull Project project,
-                                        @NotNull String occurrenceText,
-                                        @NotNull Collection occurrenceRanges,
-                                        @NotNull TextRange occurrenceRangeAtCaret) {
+  static @Nullable ShTextRenameRefactoring create(@NotNull Editor editor,
+                                                  @NotNull Project project,
+                                                  @NotNull String occurrenceText,
+                                                  @NotNull Collection occurrenceRanges,
+                                                  @NotNull TextRange occurrenceRangeAtCaret) {
     PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
     if (psiFile != null) {
       return new ShTextRenameRefactoring(editor, project, psiFile, occurrenceText, occurrenceRanges, occurrenceRangeAtCaret);
@@ -125,8 +124,7 @@ final class ShTextRenameRefactoring {
     }
   }
 
-  @Nullable
-  private static TextAttributes getAttributes(@NotNull EditorColorsManager colorsManager, @NotNull String segmentName) {
+  private static @Nullable TextAttributes getAttributes(@NotNull EditorColorsManager colorsManager, @NotNull String segmentName) {
     if (segmentName.equals(PRIMARY_VARIABLE_NAME)) {
       return colorsManager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
     }
diff --git a/plugins/sh/core/src/com/intellij/sh/rename/TextOccurrencesRenamer.java b/plugins/sh/core/src/com/intellij/sh/rename/TextOccurrencesRenamer.java
index 54d49d7d94ea..fbaeff0c50cf 100644
--- a/plugins/sh/core/src/com/intellij/sh/rename/TextOccurrencesRenamer.java
+++ b/plugins/sh/core/src/com/intellij/sh/rename/TextOccurrencesRenamer.java
@@ -32,13 +32,11 @@ class TextOccurrencesRenamer {
     myInitialModificationStamp = myEditor.getDocument().getModificationStamp();
   }
 
-  @NotNull
-  public String getOldName() {
+  public @NotNull String getOldName() {
     return myOldName;
   }
 
-  @NotNull
-  public Editor getEditor() {
+  public @NotNull Editor getEditor() {
     return myEditor;
   }
 
@@ -62,8 +60,7 @@ class TextOccurrencesRenamer {
     });
   }
 
-  @NotNull
-  private String getNewDocumentText(@NotNull CharSequence documentText, @NotNull String newName) {
+  private @NotNull String getNewDocumentText(@NotNull CharSequence documentText, @NotNull String newName) {
     TextRange prevOccurrence = null;
     StringBuilder result = new StringBuilder(documentText.length() + (newName.length() - myOldName.length()) * myOccurrences.size());
     for (TextRange occurrence : myOccurrences) {
diff --git a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfiguration.java b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfiguration.java
index 5d98383110c5..c2a94aed9deb 100644
--- a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfiguration.java
+++ b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfiguration.java
@@ -34,15 +34,15 @@ import static com.intellij.openapi.util.text.StringUtilRt.notNullize;
 import static com.intellij.sh.ShBundle.message;
 
 public final class ShRunConfiguration extends LocatableConfigurationBase implements RefactoringListenerProvider {
-  @NonNls private static final String TAG_PREFIX = "INDEPENDENT_";
-  @NonNls private static final String SCRIPT_TEXT_TAG = "SCRIPT_TEXT";
-  @NonNls private static final String SCRIPT_PATH_TAG = "SCRIPT_PATH";
-  @NonNls private static final String SCRIPT_OPTIONS_TAG = "SCRIPT_OPTIONS";
-  @NonNls private static final String SCRIPT_WORKING_DIRECTORY_TAG = "SCRIPT_WORKING_DIRECTORY";
-  @NonNls private static final String INTERPRETER_PATH_TAG = "INTERPRETER_PATH";
-  @NonNls private static final String INTERPRETER_OPTIONS_TAG = "INTERPRETER_OPTIONS";
-  @NonNls private static final String EXECUTE_IN_TERMINAL_TAG = "EXECUTE_IN_TERMINAL";
-  @NonNls private static final String EXECUTE_SCRIPT_FILE_TAG = "EXECUTE_SCRIPT_FILE";
+  private static final @NonNls String TAG_PREFIX = "INDEPENDENT_";
+  private static final @NonNls String SCRIPT_TEXT_TAG = "SCRIPT_TEXT";
+  private static final @NonNls String SCRIPT_PATH_TAG = "SCRIPT_PATH";
+  private static final @NonNls String SCRIPT_OPTIONS_TAG = "SCRIPT_OPTIONS";
+  private static final @NonNls String SCRIPT_WORKING_DIRECTORY_TAG = "SCRIPT_WORKING_DIRECTORY";
+  private static final @NonNls String INTERPRETER_PATH_TAG = "INTERPRETER_PATH";
+  private static final @NonNls String INTERPRETER_OPTIONS_TAG = "INTERPRETER_OPTIONS";
+  private static final @NonNls String EXECUTE_IN_TERMINAL_TAG = "EXECUTE_IN_TERMINAL";
+  private static final @NonNls String EXECUTE_SCRIPT_FILE_TAG = "EXECUTE_SCRIPT_FILE";
 
   private String myScriptText = "";
   private String myScriptPath = "";
@@ -58,9 +58,8 @@ public final class ShRunConfiguration extends LocatableConfigurationBase impleme
     super(project, factory, name);
   }
 
-  @NotNull
   @Override
-  public SettingsEditor getConfigurationEditor() {
+  public @NotNull SettingsEditor getConfigurationEditor() {
     return new ShRunConfigurationEditor(getProject());
   }
 
@@ -119,9 +118,8 @@ public final class ShRunConfiguration extends LocatableConfigurationBase impleme
     myEnvData = EnvironmentVariablesData.readExternal(element);
   }
 
-  @Nullable
   @Override
-  public RefactoringElementListener getRefactoringElementListener(PsiElement element) {
+  public @Nullable RefactoringElementListener getRefactoringElementListener(PsiElement element) {
     if (StringUtil.isEmpty(myScriptPath) || !(element instanceof ShFile) || !myScriptPath.equals(getPathByElement(element))) return null;
 
     return new RefactoringElementAdapter() {
@@ -139,8 +137,7 @@ public final class ShRunConfiguration extends LocatableConfigurationBase impleme
     };
   }
 
-  @Nullable
-  private static String getPathByElement(@NotNull PsiElement element) {
+  private static @Nullable String getPathByElement(@NotNull PsiElement element) {
     VirtualFile vfile = PsiUtilCore.getVirtualFile(element);
     if (vfile == null) return null;
     return vfile.getPath();
@@ -158,8 +155,7 @@ public final class ShRunConfiguration extends LocatableConfigurationBase impleme
            : toSystemDependentName(readStringTagValue(element, pathTag));
   }
 
-  @NotNull
-  private static String readStringTagValue(@NotNull Element element, @NotNull String tagName) {
+  private static @NotNull String readStringTagValue(@NotNull Element element, @NotNull String tagName) {
     return notNullize(JDOMExternalizerUtil.readField(element, tagName), "");
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationEditor.java b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationEditor.java
index 8e29a9b04dc2..1364fdee83a0 100644
--- a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationEditor.java
+++ b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationEditor.java
@@ -96,9 +96,8 @@ public class ShRunConfigurationEditor extends SettingsEditor
     configuration.setInterpreterOptions(myInterpreterOptions.getText());
   }
 
-  @NotNull
   @Override
-  protected JComponent createEditor() {
+  protected @NotNull JComponent createEditor() {
     return myPanel;
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProducer.java b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProducer.java
index c44b1ce638de..855bbcee6b02 100644
--- a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProducer.java
+++ b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProducer.java
@@ -19,9 +19,8 @@ import org.jetbrains.annotations.NotNull;
 import static com.intellij.sh.run.ShRunFileAction.parseInterpreterAndOptions;
 
 final class ShRunConfigurationProducer extends LazyRunConfigurationProducer {
-  @NotNull
   @Override
-  public ConfigurationFactory getConfigurationFactory() {
+  public @NotNull ConfigurationFactory getConfigurationFactory() {
     return ShConfigurationType.getInstance();
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProfileState.java b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProfileState.java
index 2a8564be0e7f..c22aee69d6ba 100644
--- a/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProfileState.java
+++ b/plugins/sh/core/src/com/intellij/sh/run/ShRunConfigurationProfileState.java
@@ -21,7 +21,6 @@ import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.sh.ShBundle;
 import com.intellij.sh.ShStringUtil;
 import com.intellij.terminal.TerminalExecutionConsole;
-import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.execution.ParametersListUtil;
 import com.intellij.util.io.BaseOutputReader;
@@ -74,19 +73,16 @@ final class ShRunConfigurationProfileState implements RunProfileState {
     return new DefaultExecutionResult(console, processHandler);
   }
 
-  @NotNull
-  private static ProcessHandler createProcessHandler(GeneralCommandLine commandLine) throws ExecutionException {
+  private static @NotNull ProcessHandler createProcessHandler(GeneralCommandLine commandLine) throws ExecutionException {
     return new KillableProcessHandler(commandLine) {
-      @NotNull
       @Override
-      protected BaseOutputReader.Options readerOptions() {
+      protected @NotNull BaseOutputReader.Options readerOptions() {
         return BaseOutputReader.Options.forTerminalPtyProcess();
       }
     };
   }
 
-  @NotNull
-  private GeneralCommandLine createCommandLineForScript() {
+  private @NotNull GeneralCommandLine createCommandLineForScript() {
     PtyCommandLine commandLine = new PtyCommandLine();
     commandLine.withConsoleMode(false);
     commandLine.withInitialColumns(120);
@@ -98,8 +94,7 @@ final class ShRunConfigurationProfileState implements RunProfileState {
     return commandLine;
   }
 
-  @NotNull
-  private GeneralCommandLine createCommandLineForFile() throws ExecutionException {
+  private @NotNull GeneralCommandLine createCommandLineForFile() throws ExecutionException {
     VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(myRunConfiguration.getScriptPath());
     if (virtualFile == null || virtualFile.getParent() == null) {
       throw new ExecutionException(ShBundle.message("error.message.cannot.determine.shell.script.parent.directory"));
@@ -142,8 +137,7 @@ final class ShRunConfigurationProfileState implements RunProfileState {
     return isRunBeforeConfig;
   }
 
-  @NotNull
-  private String buildCommand() {
+  private @NotNull String buildCommand() {
     if (myRunConfiguration.isExecuteScriptFile()) {
       final WSLDistribution wslDistribution = ShRunConfiguration.getWSLDistributionIfNeeded(myRunConfiguration.getInterpreterPath(),
                                                                                             myRunConfiguration.getScriptPath());
diff --git a/plugins/sh/core/src/com/intellij/sh/run/ShRunLineMarkerContributor.java b/plugins/sh/core/src/com/intellij/sh/run/ShRunLineMarkerContributor.java
index a297c3229a0e..2e89851fa6bf 100644
--- a/plugins/sh/core/src/com/intellij/sh/run/ShRunLineMarkerContributor.java
+++ b/plugins/sh/core/src/com/intellij/sh/run/ShRunLineMarkerContributor.java
@@ -18,9 +18,8 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 final class ShRunLineMarkerContributor extends RunLineMarkerContributor implements DumbAware {
-  @Nullable
   @Override
-  public Info getInfo(@NotNull PsiElement element) {
+  public @Nullable Info getInfo(@NotNull PsiElement element) {
     if (element instanceof OuterLanguageElementImpl || !(element instanceof LeafElement ) || element.getTextRange().getStartOffset() != 0)
       return null;
     var contributionProhibited = ContainerUtil.exists(ShRunnerAdditionalCondition.EP.getExtensionsIfPointIsRegistered(), additionalCondition -> {
diff --git a/plugins/sh/core/src/com/intellij/sh/settings/ShSettings.java b/plugins/sh/core/src/com/intellij/sh/settings/ShSettings.java
index aeff9342f0dd..ac223ffec5af 100644
--- a/plugins/sh/core/src/com/intellij/sh/settings/ShSettings.java
+++ b/plugins/sh/core/src/com/intellij/sh/settings/ShSettings.java
@@ -17,8 +17,7 @@ public final class ShSettings {
   private static final String SHFMT_PATH = "SHFMT.PATH";
   private static final String SHFMT_SKIPPED_VERSION = "SHFMT.SKIPPED.VERSION";
 
-  @NotNull
-  public static String getShellcheckPath() {
+  public static @NotNull String getShellcheckPath() {
     return PropertiesComponent.getInstance().getValue(SHELLCHECK_PATH, "");
   }
 
@@ -26,8 +25,7 @@ public final class ShSettings {
     if (StringUtil.isNotEmpty(path)) PropertiesComponent.getInstance().setValue(SHELLCHECK_PATH, path);
   }
 
-  @NotNull
-  public static String getShfmtPath() {
+  public static @NotNull String getShfmtPath() {
     return PropertiesComponent.getInstance().getValue(SHFMT_PATH, "");
   }
 
@@ -35,8 +33,7 @@ public final class ShSettings {
     if (StringUtil.isNotEmpty(path)) PropertiesComponent.getInstance().setValue(SHFMT_PATH, path);
   }
 
-  @NotNull
-  public static String getSkippedShellcheckVersion() {
+  public static @NotNull String getSkippedShellcheckVersion() {
     return PropertiesComponent.getInstance().getValue(SHELLCHECK_SKIPPED_VERSION, "");
   }
 
@@ -44,8 +41,7 @@ public final class ShSettings {
     if (StringUtil.isNotEmpty(version)) PropertiesComponent.getInstance().setValue(SHELLCHECK_SKIPPED_VERSION, version);
   }
 
-  @NotNull
-  public static String getSkippedShfmtVersion() {
+  public static @NotNull String getSkippedShfmtVersion() {
     return PropertiesComponent.getInstance().getValue(SHFMT_SKIPPED_VERSION, "");
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShQuickFixIntention.java b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShQuickFixIntention.java
index 780b1657b153..016b35ac3ad0 100644
--- a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShQuickFixIntention.java
+++ b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShQuickFixIntention.java
@@ -25,9 +25,8 @@ public class ShQuickFixIntention implements IntentionAction {
     this.fix = fix;
   }
 
-  @NotNull
   @Override
-  public String getFamilyName() {
+  public @NotNull String getFamilyName() {
     return ShBundle.message("sh.shell.script");
   }
 
@@ -41,9 +40,8 @@ public class ShQuickFixIntention implements IntentionAction {
     return true;
   }
 
-  @NotNull
   @Override
-  public String getText() {
+  public @NotNull String getText() {
     return message;
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckExternalAnnotator.java b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckExternalAnnotator.java
index 0ca6faea92ae..0255851bb570 100644
--- a/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckExternalAnnotator.java
+++ b/plugins/sh/core/src/com/intellij/sh/shellcheck/ShShellcheckExternalAnnotator.java
@@ -62,9 +62,8 @@ public class ShShellcheckExternalAnnotator extends ExternalAnnotator getShellcheckExecutionParams(@NotNull PsiFile file) {
+  private static @NotNull List<@NlsSafe String> getShellcheckExecutionParams(@NotNull PsiFile file) {
     String interpreter = getInterpreter(file);
     List params = new SmartList<>();
     ShShellcheckInspection inspection = ShShellcheckInspection.findShShellcheckInspection(file);
@@ -193,18 +189,15 @@ public class ShShellcheckExternalAnnotator extends ExternalAnnotator myDisabledInspections = new TreeSet<>();
   private JComponent myOptionsPanel;
@@ -36,9 +36,8 @@ public final class ShShellcheckInspection extends LocalInspectionTool implements
     return SuppressQuickFix.EMPTY_ARRAY;
   }
 
-  @NotNull
   @Override
-  public String getShortName() {
+  public @NotNull String getShortName() {
     return SHORT_NAME;
   }
 
@@ -64,9 +63,8 @@ public final class ShShellcheckInspection extends LocalInspectionTool implements
     }
   }
 
-  @Nullable
   @Override
-  public JComponent createOptionsPanel() {
+  public @Nullable JComponent createOptionsPanel() {
     myOptionsPanel = new ShellcheckOptionsPanel(getDisabledInspections(), this::onInspectionChange).getPanel();
     return myOptionsPanel;
   }
@@ -89,8 +87,7 @@ public final class ShShellcheckInspection extends LocalInspectionTool implements
     }
   }
 
-  @NotNull
-  static ShShellcheckInspection findShShellcheckInspection(@NotNull PsiElement element) {
+  static @NotNull ShShellcheckInspection findShShellcheckInspection(@NotNull PsiElement element) {
     InspectionProfile profile = InspectionProjectProfileManager.getInstance(element.getProject()).getCurrentProfile();
     ShShellcheckInspection tool = (ShShellcheckInspection)profile.getUnwrappedTool(SHORT_NAME, element);
     return tool == null ? new ShShellcheckInspection() : tool;
diff --git a/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShDisableInspectionIntention.java b/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShDisableInspectionIntention.java
index bd4501486d50..cebf06879ecc 100644
--- a/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShDisableInspectionIntention.java
+++ b/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShDisableInspectionIntention.java
@@ -28,15 +28,13 @@ public class ShDisableInspectionIntention implements IntentionAction, LowPriorit
     myMessage = message;
   }
 
-  @NotNull
   @Override
-  public String getText() {
+  public @NotNull String getText() {
     return ShBundle.message("sh.disable.inspection.text", myMessage);
   }
 
-  @NotNull
   @Override
-  public String getFamilyName() {
+  public @NotNull String getFamilyName() {
     return ShBundle.message("sh.shell.script");
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShSuppressInspectionIntention.java b/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShSuppressInspectionIntention.java
index 97984f07c0ac..d5fb31cd4c72 100644
--- a/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShSuppressInspectionIntention.java
+++ b/plugins/sh/core/src/com/intellij/sh/shellcheck/intention/ShSuppressInspectionIntention.java
@@ -22,15 +22,13 @@ public class ShSuppressInspectionIntention implements IntentionAction {
     myOffset = offset;
   }
 
-  @NotNull
   @Override
-  public String getText() {
+  public @NotNull String getText() {
     return ShBundle.message("sh.suppress.inspection", myMessage);
   }
 
-  @NotNull
   @Override
-  public String getFamilyName() {
+  public @NotNull String getFamilyName() {
     return ShBundle.message("sh.shell.script");
   }
 
diff --git a/plugins/sh/core/src/com/intellij/sh/spellchecker/ShSpellcheckingStrategy.java b/plugins/sh/core/src/com/intellij/sh/spellchecker/ShSpellcheckingStrategy.java
index 5ddd80ce0898..334ca5247285 100644
--- a/plugins/sh/core/src/com/intellij/sh/spellchecker/ShSpellcheckingStrategy.java
+++ b/plugins/sh/core/src/com/intellij/sh/spellchecker/ShSpellcheckingStrategy.java
@@ -16,9 +16,8 @@ import static com.intellij.sh.lexer.ShTokenTypes.COMMENT;
 public class ShSpellcheckingStrategy extends SpellcheckingStrategy implements DumbAware {
   private static final TokenSet TOKENS_WITH_TEXT = TokenSet.create(STRING_CONTENT, RAW_STRING, HEREDOC_CONTENT, COMMENT);
 
-  @NotNull
   @Override
-  public Tokenizer getTokenizer(PsiElement element) {
+  public @NotNull Tokenizer getTokenizer(PsiElement element) {
     final ASTNode node = element.getNode();
     if (node != null && TOKENS_WITH_TEXT.contains(node.getElementType())) return TEXT_TOKENIZER;
     if (element instanceof PsiNameIdentifierOwner) return ShIdentifierOwnerTokenizer.INSTANCE;
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java
index 3f23e7184e50..0f27ceda35cb 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/action/TraceStreamAction.java
@@ -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 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.debugger.streams.action;
 
 import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
@@ -154,17 +154,15 @@ public final class TraceStreamAction extends AnAction {
       this.provider = chain.provider;
     }
 
-    @NotNull
     @Override
-    public Stream rangeStream() {
+    public @NotNull Stream rangeStream() {
       return Stream.of(
         new TextRange(chain.getQualifierExpression().getTextRange().getStartOffset(),
                       chain.getTerminationCall().getTextRange().getEndOffset()));
     }
 
-    @NotNull
     @Override
-    public String getText() {
+    public @NotNull String getText() {
       return chain.getCompactText();
     }
   }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/LibrarySupportProvider.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/LibrarySupportProvider.java
index b24b26d24a51..8e7639b405db 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/LibrarySupportProvider.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/LibrarySupportProvider.java
@@ -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.debugger.streams.lib;
 
 import com.intellij.debugger.streams.trace.TraceExpressionBuilder;
@@ -16,8 +16,7 @@ import java.util.List;
 public interface LibrarySupportProvider {
   ExtensionPointName EP_NAME = ExtensionPointName.create("org.jetbrains.debugger.streams.librarySupport");
 
-  @NotNull
-  static List getList() {
+  static @NotNull List getList() {
     return EP_NAME.getExtensionList();
   }
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/PsiUtil.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/PsiUtil.java
index a646759a96a9..cee917720514 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/PsiUtil.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/PsiUtil.java
@@ -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.debugger.streams.psi;
 
 import com.intellij.psi.PsiElement;
@@ -12,8 +12,7 @@ import org.jetbrains.annotations.NotNull;
 public final class PsiUtil {
   private PsiUtil() {}
 
-  @NotNull
-  public static PsiElement ignoreWhiteSpaces(@NotNull PsiElement element) {
+  public static @NotNull PsiElement ignoreWhiteSpaces(@NotNull PsiElement element) {
     PsiElement result = PsiTreeUtil.skipSiblingsForward(element, PsiWhiteSpace.class);
     if (result == null) {
       result = PsiTreeUtil.skipSiblingsBackward(element, PsiWhiteSpace.class);
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java
index 2ab1e9d78a1a..25fb544315c8 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaChainTransformerImpl.java
@@ -1,4 +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.debugger.streams.psi.impl;
 
 import com.intellij.debugger.streams.psi.ChainTransformer;
@@ -24,10 +24,9 @@ import java.util.stream.Collectors;
  * @author Vitaliy.Bibaev
  */
 public class JavaChainTransformerImpl implements ChainTransformer.Java {
-  @NotNull
   @Override
-  public StreamChain transform(@NotNull List streamExpressions,
-                               @NotNull PsiElement context) {
+  public @NotNull StreamChain transform(@NotNull List streamExpressions,
+                                        @NotNull PsiElement context) {
     final PsiMethodCallExpression firstCall = streamExpressions.get(0);
 
     final PsiExpression qualifierExpression = firstCall.getMethodExpression().getQualifierExpression();
@@ -49,17 +48,15 @@ public class JavaChainTransformerImpl implements ChainTransformer.Java {
     return new StreamChainImpl(qualifier, intermediateCalls, terminationCall, context);
   }
 
-  @NotNull
-  private static GenericType getGenericTypeOfThis(PsiExpression expression) {
+  private static @NotNull GenericType getGenericTypeOfThis(PsiExpression expression) {
     final PsiClass klass = PsiUtil.getContainingClass(expression);
 
     return klass == null ? JavaTypes.INSTANCE.getANY()
                          : JavaTypes.INSTANCE.fromPsiClass(klass);
   }
 
-  @NotNull
-  private static List createIntermediateCalls(@NotNull GenericType producerAfterType,
-                                                                      @NotNull List expressions) {
+  private static @NotNull List createIntermediateCalls(@NotNull GenericType producerAfterType,
+                                                                               @NotNull List expressions) {
     final List result = new ArrayList<>();
 
     GenericType typeBefore = producerAfterType;
@@ -74,16 +71,14 @@ public class JavaChainTransformerImpl implements ChainTransformer.Java {
     return result;
   }
 
-  @NotNull
-  private static TerminatorStreamCall createTerminationCall(@NotNull GenericType typeBefore, @NotNull PsiMethodCallExpression expression) {
+  private static @NotNull TerminatorStreamCall createTerminationCall(@NotNull GenericType typeBefore, @NotNull PsiMethodCallExpression expression) {
     final String name = resolveMethodName(expression);
     final List args = resolveArguments(expression);
     final GenericType resultType = resolveTerminationCallType(expression);
     return new TerminatorStreamCallImpl(name, args, typeBefore, resultType, expression.getTextRange());
   }
 
-  @NotNull
-  private static List resolveArguments(@NotNull PsiMethodCallExpression methodCall) {
+  private static @NotNull List resolveArguments(@NotNull PsiMethodCallExpression methodCall) {
     final PsiExpressionList list = methodCall.getArgumentList();
     return StreamEx.of(list.getExpressions())
       .zipWith(StreamEx.of(list.getExpressionTypes()),
@@ -92,27 +87,23 @@ public class JavaChainTransformerImpl implements ChainTransformer.Java {
       .collect(Collectors.toList());
   }
 
-  @NotNull
-  private static String resolveMethodName(@NotNull PsiMethodCallExpression methodCall) {
+  private static @NotNull String resolveMethodName(@NotNull PsiMethodCallExpression methodCall) {
     final String name = methodCall.getMethodExpression().getReferenceName();
     Objects.requireNonNull(name, "Method reference must be not null" + methodCall.getText());
     return name;
   }
 
-  @NotNull
-  private static PsiType extractType(@NotNull PsiMethodCallExpression expression) {
+  private static @NotNull PsiType extractType(@NotNull PsiMethodCallExpression expression) {
     final PsiType returnType = expression.getType();
     Objects.requireNonNull(returnType, "Method return type must be not null" + expression.getText());
     return returnType;
   }
 
-  @NotNull
-  private static GenericType resolveType(@NotNull PsiMethodCallExpression call) {
+  private static @NotNull GenericType resolveType(@NotNull PsiMethodCallExpression call) {
     return JavaTypes.INSTANCE.fromStreamPsiType(extractType(call));
   }
 
-  @NotNull
-  private static GenericType resolveTerminationCallType(@NotNull PsiMethodCallExpression call) {
+  private static @NotNull GenericType resolveTerminationCallType(@NotNull PsiMethodCallExpression call) {
     return JavaTypes.INSTANCE.fromPsiType(extractType(call));
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaStreamChainBuilder.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaStreamChainBuilder.java
index 11d0fb260fa2..4d8282c0f0c3 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaStreamChainBuilder.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/impl/JavaStreamChainBuilder.java
@@ -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.debugger.streams.psi.impl;
 
 import com.intellij.debugger.streams.psi.ChainDetector;
@@ -42,10 +42,8 @@ public class JavaStreamChainBuilder implements StreamChainBuilder {
     return false;
   }
 
-  @NotNull
   @Override
-  @Unmodifiable
-  public List build(@NotNull PsiElement startElement) {
+  public @NotNull @Unmodifiable List build(@NotNull PsiElement startElement) {
     final MyChainCollectorVisitor visitor = new MyChainCollectorVisitor();
 
     PsiElement current = getLatestElementInCurrentScope(PsiUtil.ignoreWhiteSpaces(startElement));
@@ -58,8 +56,7 @@ public class JavaStreamChainBuilder implements StreamChainBuilder {
     return buildChains(chains, startElement);
   }
 
-  @Nullable
-  private static PsiElement toUpperLevel(@NotNull PsiElement element) {
+  private static @Nullable PsiElement toUpperLevel(@NotNull PsiElement element) {
     element = element.getParent();
     while (element != null && !(element instanceof PsiLambdaExpression) && !(element instanceof PsiAnonymousClass)) {
       element = element.getParent();
@@ -68,9 +65,8 @@ public class JavaStreamChainBuilder implements StreamChainBuilder {
     return getLatestElementInCurrentScope(element);
   }
 
-  @Nullable
   @Contract("null -> null")
-  private static PsiElement getLatestElementInCurrentScope(@Nullable PsiElement element) {
+  private static @Nullable PsiElement getLatestElementInCurrentScope(@Nullable PsiElement element) {
     PsiElement current = element;
     while (current != null) {
       final PsiElement parent = current.getParent();
@@ -85,9 +81,7 @@ public class JavaStreamChainBuilder implements StreamChainBuilder {
     return current;
   }
 
-  @NotNull
-  @Unmodifiable
-  private List buildChains(@NotNull List> chains, @NotNull PsiElement context) {
+  private @NotNull @Unmodifiable List buildChains(@NotNull List> chains, @NotNull PsiElement context) {
     return ContainerUtil.map(chains, x -> myChainTransformer.transform(x, context));
   }
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/AllToResultResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/AllToResultResolver.java
index 305c83c198ae..e5450c602d9b 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/AllToResultResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/AllToResultResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -11,9 +11,8 @@ import java.util.*;
  * @author Vitaliy.Bibaev
  */
 public class AllToResultResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map before = info.getValuesOrderBefore();
     final Map after = info.getValuesOrderAfter();
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/DistinctResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/DistinctResolver.java
index 358aa716b3ce..7e4bc9f29550 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/DistinctResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/DistinctResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -12,9 +12,8 @@ import java.util.Map;
  * @author Vitaliy.Bibaev
  */
 public class DistinctResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map> direct = info.getDirectTrace();
     final Map> reverse = info.getReverseTrace();
     if (direct == null || reverse == null) {
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/EmptyResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/EmptyResolver.java
index bd869fde8d0b..dc18fa046c30 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/EmptyResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/EmptyResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -14,17 +14,15 @@ import java.util.stream.Collectors;
  * @author Vitaliy.Bibaev
  */
 public class EmptyResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map orderBefore = info.getValuesOrderBefore();
     final Map orderAfter = info.getValuesOrderAfter();
 
     return Result.of(toEmptyMap(orderBefore), toEmptyMap(orderAfter));
   }
 
-  @NotNull
-  private static Map> toEmptyMap(@NotNull Map order) {
+  private static @NotNull Map> toEmptyMap(@NotNull Map order) {
     return order.keySet().stream().collect(Collectors.toMap(order::get, x -> Collections.emptyList()));
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FilterResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FilterResolver.java
index 305afe0a0ef6..a84691757411 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FilterResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FilterResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -12,9 +12,8 @@ import java.util.*;
  * @author Vitaliy.Bibaev
  */
 public class FilterResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map before = info.getValuesOrderBefore();
     final Map after = info.getValuesOrderAfter();
     assert before.size() >= after.size();
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FlatMapResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FlatMapResolver.java
index 7d74ebdd9e34..0c24286f9891 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FlatMapResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/FlatMapResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -11,9 +11,8 @@ import java.util.*;
  * @author Vitaliy.Bibaev
  */
 public class FlatMapResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map before = info.getValuesOrderBefore();
     final Map after = info.getValuesOrderAfter();
     final Map> forward = new HashMap<>();
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/IdentityResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/IdentityResolver.java
index 18fba250d006..54388df2e21a 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/IdentityResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/IdentityResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -19,9 +19,8 @@ import java.util.Map;
  */
 public class IdentityResolver implements ValuesOrderResolver {
   private static final Object NULL_MARKER = ObjectUtils.sentinel("IdentityResolver.NULL_MARKER");
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map before = info.getValuesOrderBefore();
     final Map after = info.getValuesOrderAfter();
 
@@ -55,8 +54,7 @@ public class IdentityResolver implements ValuesOrderResolver {
     return Result.of(direct, reverse);
   }
 
-  @NotNull
-  private static Object extractKey(@NotNull TraceElement element) {
+  private static @NotNull Object extractKey(@NotNull TraceElement element) {
     final Object key = TraceUtil.extractKey(element);
     return key == null ? NULL_MARKER : key;
   }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/MapResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/MapResolver.java
index 983ca14aeb23..841a10af4ac4 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/MapResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/MapResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -11,9 +11,8 @@ import java.util.*;
  * @author Vitaliy.Bibaev
  */
 public class MapResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map before = info.getValuesOrderBefore();
     final Map after = info.getValuesOrderAfter();
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/OptionalOrderResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/OptionalOrderResolver.java
index 5c3a6d36359d..e3d9eaf9f3a4 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/OptionalOrderResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/OptionalOrderResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -12,9 +12,8 @@ import java.util.*;
  * @author Vitaliy.Bibaev
  */
 public class OptionalOrderResolver implements ValuesOrderResolver {
-  @NotNull
   @Override
-  public Result resolve(@NotNull TraceInfo info) {
+  public @NotNull Result resolve(@NotNull TraceInfo info) {
     final Map> forward = new LinkedHashMap<>();
     final Map> backward = new LinkedHashMap<>();
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/ValuesOrderResolver.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/ValuesOrderResolver.java
index 3bcf0f1c3ba0..c8604510e414 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/ValuesOrderResolver.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/ValuesOrderResolver.java
@@ -1,4 +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.debugger.streams.resolve;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -24,15 +24,13 @@ public interface ValuesOrderResolver {
 
     static Result of(@NotNull Map> direct, @NotNull Map> reverse) {
       return new Result() {
-        @NotNull
         @Override
-        public Map> getDirectOrder() {
+        public @NotNull Map> getDirectOrder() {
           return direct;
         }
 
-        @NotNull
         @Override
-        public Map> getReverseOrder() {
+        public @NotNull Map> getReverseOrder() {
           return reverse;
         }
       };
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedIntermediateCallImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedIntermediateCallImpl.java
index bf5871a290b0..b0ba08b06b63 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedIntermediateCallImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedIntermediateCallImpl.java
@@ -1,4 +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.debugger.streams.resolve.impl;
 
 import com.intellij.debugger.streams.resolve.ResolvedStreamCall;
@@ -23,21 +23,18 @@ public class ResolvedIntermediateCallImpl implements ResolvedStreamCall.Intermed
     myStateAfter = stateAfter;
   }
 
-  @NotNull
   @Override
-  public IntermediateStreamCall getCall() {
+  public @NotNull IntermediateStreamCall getCall() {
     return myCall;
   }
 
-  @NotNull
   @Override
-  public NextAwareState getStateBefore() {
+  public @NotNull NextAwareState getStateBefore() {
     return myStateBefore;
   }
 
-  @NotNull
   @Override
-  public PrevAwareState getStateAfter() {
+  public @NotNull PrevAwareState getStateAfter() {
     return myStateAfter;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedStreamChainImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedStreamChainImpl.java
index ca60a8e66aa8..f9a614979221 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedStreamChainImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedStreamChainImpl.java
@@ -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.debugger.streams.resolve.impl;
 
 import com.intellij.debugger.streams.resolve.ResolvedStreamCall;
@@ -22,15 +22,13 @@ public class ResolvedStreamChainImpl implements ResolvedStreamChain {
     myIntermediateCalls = List.copyOf(intermediates);
   }
 
-  @NotNull
   @Override
-  public ResolvedStreamCall.Terminator getTerminator() {
+  public @NotNull ResolvedStreamCall.Terminator getTerminator() {
     return myTerminator;
   }
 
-  @NotNull
   @Override
-  public List getIntermediateCalls() {
+  public @NotNull List getIntermediateCalls() {
     return myIntermediateCalls;
   }
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedTerminatorCallImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedTerminatorCallImpl.java
index 9c178af8ce71..6b885b4399e5 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedTerminatorCallImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/resolve/impl/ResolvedTerminatorCallImpl.java
@@ -1,4 +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.debugger.streams.resolve.impl;
 
 import com.intellij.debugger.streams.resolve.ResolvedStreamCall;
@@ -24,21 +24,18 @@ public class ResolvedTerminatorCallImpl implements ResolvedStreamCall.Terminator
     myStateAfter = stateAfter;
   }
 
-  @NotNull
   @Override
-  public TerminatorStreamCall getCall() {
+  public @NotNull TerminatorStreamCall getCall() {
     return myCall;
   }
 
-  @Nullable
   @Override
-  public PrevAwareState getStateAfter() {
+  public @Nullable PrevAwareState getStateAfter() {
     return myStateAfter;
   }
 
-  @NotNull
   @Override
-  public NextAwareState getStateBefore() {
+  public @NotNull NextAwareState getStateBefore() {
     return myStateBefore;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/CallTransformer.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/CallTransformer.java
index 307fd8f91d2c..6b54e67d98d9 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/CallTransformer.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/CallTransformer.java
@@ -1,12 +1,11 @@
-// 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.debugger.streams.trace;
 
 import com.intellij.debugger.streams.wrapper.StreamCall;
 import org.jetbrains.annotations.NotNull;
 
 public interface CallTransformer {
-  @NotNull
-  default T transformCall(@NotNull T call) {
+  default @NotNull T transformCall(@NotNull T call) {
     return call;
   }
 }
\ No newline at end of file
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/IntermediateState.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/IntermediateState.java
index 78b54331b258..a9fc20354abd 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/IntermediateState.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/IntermediateState.java
@@ -1,4 +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.debugger.streams.trace;
 
 import com.intellij.util.containers.ContainerUtil;
@@ -16,9 +16,7 @@ public interface IntermediateState {
   @NotNull
   List getTrace();
 
-  @NotNull
-  @Unmodifiable
-  default List getRawValues() {
+  default @NotNull @Unmodifiable List getRawValues() {
     return ContainerUtil.map(getTrace(), TraceElement::getValue);
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/FirstStateImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/FirstStateImpl.java
index f82e78b346f6..fc9c5b7dc5cf 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/FirstStateImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/FirstStateImpl.java
@@ -1,4 +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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.trace.NextAwareState;
@@ -25,15 +25,13 @@ public class FirstStateImpl extends StateBase implements NextAwareState {
     myToNext = toNextMapping;
   }
 
-  @NotNull
   @Override
-  public StreamCall getNextCall() {
+  public @NotNull StreamCall getNextCall() {
     return myNextCall;
   }
 
-  @NotNull
   @Override
-  public List getNextValues(@NotNull TraceElement value) {
+  public @NotNull List getNextValues(@NotNull TraceElement value) {
     return myToNext.getOrDefault(value, Collections.emptyList());
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/IntermediateStateImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/IntermediateStateImpl.java
index 610ecfa8b882..494ae047d91a 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/IntermediateStateImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/IntermediateStateImpl.java
@@ -1,4 +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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.trace.BidirectionalAwareState;
@@ -31,27 +31,23 @@ public class IntermediateStateImpl extends StateBase implements BidirectionalAwa
     myNextCall = nextCall;
   }
 
-  @NotNull
   @Override
-  public StreamCall getPrevCall() {
+  public @NotNull StreamCall getPrevCall() {
     return myPrevCall;
   }
 
-  @NotNull
   @Override
-  public List getPrevValues(@NotNull TraceElement value) {
+  public @NotNull List getPrevValues(@NotNull TraceElement value) {
     return myToPrev.getOrDefault(value, Collections.emptyList());
   }
 
-  @NotNull
   @Override
-  public StreamCall getNextCall() {
+  public @NotNull StreamCall getNextCall() {
     return myNextCall;
   }
 
-  @NotNull
   @Override
-  public List getNextValues(@NotNull TraceElement value) {
+  public @NotNull List getNextValues(@NotNull TraceElement value) {
     return myToNext.getOrDefault(value, Collections.emptyList());
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/StateBase.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/StateBase.java
index 359bdbcd7d2e..eccddebe004a 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/StateBase.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/StateBase.java
@@ -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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.trace.IntermediateState;
@@ -17,9 +17,8 @@ abstract class StateBase implements IntermediateState {
     myElements = List.copyOf(elements);
   }
 
-  @NotNull
   @Override
-  public List getTrace() {
+  public @NotNull List getTrace() {
     return myElements;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TerminationStateImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TerminationStateImpl.java
index fc790c7ea16a..a656fd819470 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TerminationStateImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TerminationStateImpl.java
@@ -1,4 +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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.trace.PrevAwareState;
@@ -29,21 +29,18 @@ public class TerminationStateImpl extends StateBase implements PrevAwareState {
     myToPrev = toPrevMapping;
   }
 
-  @NotNull
   @Override
-  public List getRawValues() {
+  public @NotNull List getRawValues() {
     return Collections.singletonList(myResult.getValue());
   }
 
-  @NotNull
   @Override
-  public StreamCall getPrevCall() {
+  public @NotNull StreamCall getPrevCall() {
     return myPrevCall;
   }
 
-  @NotNull
   @Override
-  public List getPrevValues(@NotNull TraceElement value) {
+  public @NotNull List getPrevValues(@NotNull TraceElement value) {
     return myToPrev.getOrDefault(value, Collections.emptyList());
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceElementImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceElementImpl.java
index 9b63b5e88ecb..6de783ef5d99 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceElementImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceElementImpl.java
@@ -1,4 +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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -42,9 +42,8 @@ public class TraceElementImpl implements TraceElement, Comparable
     return myTime;
   }
 
-  @Nullable
   @Override
-  public Value getValue() {
+  public @Nullable Value getValue() {
     return myValue;
   }
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceResultInterpreterImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceResultInterpreterImpl.java
index 6234df1fac04..2fa7c5ffa1ca 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceResultInterpreterImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TraceResultInterpreterImpl.java
@@ -1,4 +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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.lib.InterpreterFactory;
@@ -28,9 +28,8 @@ public class TraceResultInterpreterImpl implements TraceResultInterpreter {
     myInterpreterFactory = interpreterFactory;
   }
 
-  @NotNull
   @Override
-  public TracingResult interpret(@NotNull StreamChain chain, @NotNull ArrayReference resultArray) {
+  public @NotNull TracingResult interpret(@NotNull StreamChain chain, @NotNull ArrayReference resultArray) {
     final ArrayReference info = (ArrayReference)resultArray.getValue(0);
     final ArrayReference result = (ArrayReference)resultArray.getValue(1);
     final Value streamResult = result.getValue(0);
@@ -40,8 +39,7 @@ public class TraceResultInterpreterImpl implements TraceResultInterpreter {
     return new TracingResultImpl(chain, TraceElementImpl.ofResultValue(streamResult), trace, isException(result));
   }
 
-  @NotNull
-  private List getTrace(@NotNull StreamChain chain, @NotNull ArrayReference info) {
+  private @NotNull List getTrace(@NotNull StreamChain chain, @NotNull ArrayReference info) {
     final int callCount = chain.length();
     final List result = new ArrayList<>(callCount);
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TracingResultImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TracingResultImpl.java
index 8cc00928a7b3..6027e2ffc4dc 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TracingResultImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/TracingResultImpl.java
@@ -1,4 +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.debugger.streams.trace.impl;
 
 import com.intellij.debugger.streams.lib.ResolverFactory;
@@ -38,9 +38,8 @@ public class TracingResultImpl implements TracingResult {
     myIsResultException = isResultException;
   }
 
-  @NotNull
   @Override
-  public TraceElement getResult() {
+  public @NotNull TraceElement getResult() {
     return myStreamResult;
   }
 
@@ -49,15 +48,13 @@ public class TracingResultImpl implements TracingResult {
     return myIsResultException;
   }
 
-  @NotNull
   @Override
-  public List getTrace() {
+  public @NotNull List getTrace() {
     return myTrace;
   }
 
-  @NotNull
   @Override
-  public ResolvedTracingResult resolve(@NotNull ResolverFactory resolverFactory) {
+  public @NotNull ResolvedTracingResult resolve(@NotNull ResolverFactory resolverFactory) {
     assert myTrace.size() == mySourceChain.length();
 
     List resolvedTraces =
@@ -115,21 +112,19 @@ public class TracingResultImpl implements TracingResult {
 
   private class MyResolvedResult implements ResolvedTracingResult {
 
-    @NotNull private final ResolvedStreamChain myChain;
+    private final @NotNull ResolvedStreamChain myChain;
 
     MyResolvedResult(@NotNull ResolvedStreamChain resolvedStreamChain) {
       myChain = resolvedStreamChain;
     }
 
-    @NotNull
     @Override
-    public ResolvedStreamChain getResolvedChain() {
+    public @NotNull ResolvedStreamChain getResolvedChain() {
       return myChain;
     }
 
-    @NotNull
     @Override
-    public StreamChain getSourceChain() {
+    public @NotNull StreamChain getSourceChain() {
       return mySourceChain;
     }
 
@@ -138,9 +133,8 @@ public class TracingResultImpl implements TracingResult {
       return myIsResultException;
     }
 
-    @NotNull
     @Override
-    public TraceElement getResult() {
+    public @NotNull TraceElement getResult() {
       return myStreamResult;
     }
   }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/handler/PeekCall.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/handler/PeekCall.java
index 3759ffe68419..35b44a1ddd03 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/handler/PeekCall.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/handler/PeekCall.java
@@ -1,4 +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.debugger.streams.trace.impl.handler;
 
 import com.intellij.debugger.streams.trace.impl.handler.type.GenericType;
@@ -25,39 +25,33 @@ public class PeekCall implements IntermediateStreamCall {
     myElementType = elementType;
   }
 
-  @NotNull
   @Override
-  public String getName() {
+  public @NotNull String getName() {
     return "peek";
   }
 
-  @NotNull
   @Override
-  public List getArguments() {
+  public @NotNull List getArguments() {
     return myLambda;
   }
 
-  @NotNull
   @Override
-  public TextRange getTextRange() {
+  public @NotNull TextRange getTextRange() {
     return TextRange.EMPTY_RANGE;
   }
 
-  @NotNull
   @Override
-  public StreamCallType getType() {
+  public @NotNull StreamCallType getType() {
     return StreamCallType.INTERMEDIATE;
   }
 
-  @NotNull
   @Override
-  public GenericType getTypeAfter() {
+  public @NotNull GenericType getTypeAfter() {
     return myElementType;
   }
 
-  @NotNull
   @Override
-  public GenericType getTypeBefore() {
+  public @NotNull GenericType getTypeBefore() {
     return myElementType;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AllMatchTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AllMatchTraceInterpreter.java
index bbe27a8376b6..b196d8cb0a5b 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AllMatchTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AllMatchTraceInterpreter.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -17,9 +17,8 @@ public class AllMatchTraceInterpreter extends MatchInterpreterBase {
     return traceBeforeFilter.size() == traceAfterFilter.size();
   }
 
-  @NotNull
   @Override
-  protected Action getAction(boolean result) {
+  protected @NotNull Action getAction(boolean result) {
     if (result) {
       return Action.CONNECT_FILTERED;
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AnyMatchTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AnyMatchTraceInterpreter.java
index 6ad63e2d8b87..25a085a8af4b 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AnyMatchTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/AnyMatchTraceInterpreter.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -17,9 +17,8 @@ public class AnyMatchTraceInterpreter extends MatchInterpreterBase {
     return !traceAfterFilter.isEmpty();
   }
 
-  @NotNull
   @Override
-  protected Action getAction(boolean result) {
+  protected @NotNull Action getAction(boolean result) {
     if (result) {
       return Action.CONNECT_FILTERED;
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/CollectIdentityTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/CollectIdentityTraceInterpreter.java
index c34f2822da21..5a2fdc3ba6bf 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/CollectIdentityTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/CollectIdentityTraceInterpreter.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.CallTraceInterpreter;
@@ -24,9 +24,8 @@ import java.util.PrimitiveIterator;
 public class CollectIdentityTraceInterpreter implements CallTraceInterpreter {
   private final SimplePeekCallTraceInterpreter myPeekResolver = new SimplePeekCallTraceInterpreter();
 
-  @NotNull
   @Override
-  public TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
+  public @NotNull TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
     if (!(value instanceof ArrayReference array)) {
       throw new UnexpectedValueTypeException("Array reference expected. But " + value.type().name() + " received");
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/DistinctCallTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/DistinctCallTraceInterpreter.java
index 870e920f5a28..5fcec1edf693 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/DistinctCallTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/DistinctCallTraceInterpreter.java
@@ -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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.CallTraceInterpreter;
@@ -26,9 +26,8 @@ public class DistinctCallTraceInterpreter implements CallTraceInterpreter {
     DIRECT, REVERSE
   }
 
-  @NotNull
   @Override
-  public TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
+  public @NotNull TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
     if (value instanceof ArrayReference) {
       final Value peekTrace = ((ArrayReference)value).getValue(0);
       final Value trace = ((ArrayReference)value).getValue(1);
@@ -44,10 +43,9 @@ public class DistinctCallTraceInterpreter implements CallTraceInterpreter {
     throw new UnexpectedValueException("distinct trace must be an array value");
   }
 
-  @NotNull
-  private static Map> resolve(@NotNull Value value,
-                                                               @NotNull TraceInfo order,
-                                                               @NotNull Direction direction) {
+  private static @NotNull Map> resolve(@NotNull Value value,
+                                                                        @NotNull TraceInfo order,
+                                                                        @NotNull Direction direction) {
     if (value instanceof ArrayReference convertedMap) {
       final Value keys = convertedMap.getValue(0);
       final Value values = convertedMap.getValue(1);
@@ -63,10 +61,9 @@ public class DistinctCallTraceInterpreter implements CallTraceInterpreter {
     throw new UnexpectedValueException("value must be an array reference");
   }
 
-  @NotNull
-  private static Map> resolveDirectTrace(@NotNull ArrayReference keys,
-                                                                          @NotNull ArrayReference values,
-                                                                          @NotNull TraceInfo order) {
+  private static @NotNull Map> resolveDirectTrace(@NotNull ArrayReference keys,
+                                                                                   @NotNull ArrayReference values,
+                                                                                   @NotNull TraceInfo order) {
     final int size = keys.length();
     if (size != values.length()) {
       throw new UnexpectedArrayLengthException("length of keys array should be same with values array");
@@ -85,10 +82,9 @@ public class DistinctCallTraceInterpreter implements CallTraceInterpreter {
     return result;
   }
 
-  @NotNull
-  private static Map> resolveReverseTrace(@NotNull ArrayReference keys,
-                                                                           @NotNull ArrayReference values,
-                                                                           @NotNull TraceInfo order) {
+  private static @NotNull Map> resolveReverseTrace(@NotNull ArrayReference keys,
+                                                                                    @NotNull ArrayReference values,
+                                                                                    @NotNull TraceInfo order) {
     final int size = keys.length();
     if (size != values.length()) {
       throw new UnexpectedArrayLengthException("length of keys array should be same with values array");
@@ -121,15 +117,13 @@ public class DistinctCallTraceInterpreter implements CallTraceInterpreter {
       myReverseTrace = reverseTrace;
     }
 
-    @Nullable
     @Override
-    public Map> getDirectTrace() {
+    public @Nullable Map> getDirectTrace() {
       return Collections.unmodifiableMap(myDirectTrace);
     }
 
-    @Nullable
     @Override
-    public Map> getReverseTrace() {
+    public @Nullable Map> getReverseTrace() {
       return Collections.unmodifiableMap(myReverseTrace);
     }
   }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/MatchInterpreterBase.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/MatchInterpreterBase.java
index 634a9bd3fa8f..beed0a345469 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/MatchInterpreterBase.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/MatchInterpreterBase.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.CallTraceInterpreter;
@@ -25,9 +25,8 @@ import java.util.stream.Stream;
 public abstract class MatchInterpreterBase implements CallTraceInterpreter {
   private final CallTraceInterpreter myPeekResolver = new SimplePeekCallTraceInterpreter();
 
-  @NotNull
   @Override
-  public TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
+  public @NotNull TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
     if (value instanceof ArrayReference array) {
       if (array.length() != 2) {
         throw new UnexpectedArrayLengthException("trace array for *match call should contain two items. Actual = " + array.length());
@@ -58,25 +57,21 @@ public abstract class MatchInterpreterBase implements CallTraceInterpreter {
   protected abstract boolean getResult(@NotNull Collection traceBeforeFilter,
                                        @NotNull Collection traceAfterFilter);
 
-  @NotNull
-  protected abstract Action getAction(boolean result);
+  protected abstract @NotNull Action getAction(boolean result);
 
   protected enum Action {
     CONNECT_FILTERED, CONNECT_DIFFERENCE
   }
 
-  @NotNull
-  private static Map onlyFiltered(@NotNull Collection afterFilter) {
+  private static @NotNull Map onlyFiltered(@NotNull Collection afterFilter) {
     return makeIndexByTime(afterFilter.stream());
   }
 
-  @NotNull
-  private static Map difference(@NotNull Collection before, @NotNull Set timesAfter) {
+  private static @NotNull Map difference(@NotNull Collection before, @NotNull Set timesAfter) {
     return makeIndexByTime(before.stream().filter(x -> !timesAfter.contains(x.getTime())));
   }
 
-  @NotNull
-  private static Map makeIndexByTime(@NotNull Stream elementStream) {
+  private static @NotNull Map makeIndexByTime(@NotNull Stream elementStream) {
     return elementStream.collect(Collectors.toMap(TraceElement::getTime, Function.identity()));
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/NoneMatchTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/NoneMatchTraceInterpreter.java
index 651460447537..cb6f5d520b7e 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/NoneMatchTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/NoneMatchTraceInterpreter.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -17,9 +17,8 @@ public class NoneMatchTraceInterpreter extends MatchInterpreterBase {
     return traceAfterFilter.isEmpty();
   }
 
-  @NotNull
   @Override
-  protected Action getAction(boolean result) {
+  protected @NotNull Action getAction(boolean result) {
     if (result) {
       return Action.CONNECT_DIFFERENCE;
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/OptionalTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/OptionalTraceInterpreter.java
index 33e4aa325830..2754e20cf98b 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/OptionalTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/OptionalTraceInterpreter.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.CallTraceInterpreter;
@@ -23,9 +23,8 @@ import java.util.Map;
 public class OptionalTraceInterpreter implements CallTraceInterpreter {
   private final CallTraceInterpreter myPeekResolver = new SimplePeekCallTraceInterpreter();
 
-  @NotNull
   @Override
-  public TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
+  public @NotNull TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
     if (value instanceof ArrayReference) {
       final Value peeksResult = ((ArrayReference)value).getValue(0);
       final TraceInfo peekInfo = myPeekResolver.resolve(call, peeksResult);
@@ -44,8 +43,7 @@ public class OptionalTraceInterpreter implements CallTraceInterpreter {
     throw new UnexpectedValueException("trace termination with optional result must be an array value");
   }
 
-  @Nullable
-  private static Value getOptionalValue(@NotNull Value optionalTrace) {
+  private static @Nullable Value getOptionalValue(@NotNull Value optionalTrace) {
     if (!(optionalTrace instanceof ArrayReference trace)) {
       throw new UnexpectedValueTypeException("optional trace must be an array value");
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/SimplePeekCallTraceInterpreter.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/SimplePeekCallTraceInterpreter.java
index e461c54dd48f..4371a8370c08 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/SimplePeekCallTraceInterpreter.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/SimplePeekCallTraceInterpreter.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.CallTraceInterpreter;
@@ -21,9 +21,8 @@ import java.util.Map;
  * @author Vitaliy.Bibaev
  */
 public class SimplePeekCallTraceInterpreter implements CallTraceInterpreter {
-  @NotNull
   @Override
-  public TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
+  public @NotNull TraceInfo resolve(@NotNull StreamCall call, @NotNull Value value) {
     if (value instanceof ArrayReference trace) {
       final Value before = trace.getValue(0);
       final Value after = trace.getValue(1);
@@ -37,8 +36,7 @@ public class SimplePeekCallTraceInterpreter implements CallTraceInterpreter {
     throw new UnexpectedValueException("peek operation trace is wrong format");
   }
 
-  @NotNull
-  private static Map resolveTrace(@NotNull ArrayReference mapArray) {
+  private static @NotNull Map resolveTrace(@NotNull ArrayReference mapArray) {
     final Value keys = mapArray.getValue(0);
     final Value values = mapArray.getValue(1);
     if (keys instanceof ArrayReference && values instanceof ArrayReference) {
@@ -48,8 +46,7 @@ public class SimplePeekCallTraceInterpreter implements CallTraceInterpreter {
     throw new UnexpectedValueException("keys and values must be stored in arrays in peek resolver");
   }
 
-  @NotNull
-  private static Map resolveTrace(@NotNull ArrayReference keysArray, @NotNull ArrayReference valuesArray) {
+  private static @NotNull Map resolveTrace(@NotNull ArrayReference keysArray, @NotNull ArrayReference valuesArray) {
     final LinkedHashMap result = new LinkedHashMap<>();
     final List keyMirrors = keysArray.getValues();
     final List valueMirrors = valuesArray.getValues();
@@ -65,8 +62,7 @@ public class SimplePeekCallTraceInterpreter implements CallTraceInterpreter {
     throw new UnexpectedValueException("keys and values arrays should be with the same sizes");
   }
 
-  @NotNull
-  private static TraceElement resolveTraceElement(@NotNull Value key, @Nullable Value value) {
+  private static @NotNull TraceElement resolveTraceElement(@NotNull Value key, @Nullable Value value) {
     if (key instanceof IntegerValue) {
       return new TraceElementImpl(((IntegerValue)key).value(), value);
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/ValuesOrderInfo.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/ValuesOrderInfo.java
index 0a9c8f1b6d88..3382c391be8f 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/ValuesOrderInfo.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/trace/impl/interpret/ValuesOrderInfo.java
@@ -1,4 +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.debugger.streams.trace.impl.interpret;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -25,33 +25,28 @@ public class ValuesOrderInfo implements TraceInfo {
     myValuesOrderAfter = after;
   }
 
-  @NotNull
   @Override
-  public StreamCall getCall() {
+  public @NotNull StreamCall getCall() {
     return myStreamCall;
   }
 
-  @NotNull
   @Override
-  public Map getValuesOrderBefore() {
+  public @NotNull Map getValuesOrderBefore() {
     return myValuesOrderBefore;
   }
 
-  @NotNull
   @Override
-  public Map getValuesOrderAfter() {
+  public @NotNull Map getValuesOrderAfter() {
     return myValuesOrderAfter;
   }
 
-  @Nullable
   @Override
-  public Map> getDirectTrace() {
+  public @Nullable Map> getDirectTrace() {
     return null;
   }
 
-  @Nullable
   @Override
-  public Map> getReverseTrace() {
+  public @Nullable Map> getReverseTrace() {
     return null;
   }
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionTree.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionTree.java
index b6c79211f0fb..d65b532f7ab3 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionTree.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionTree.java
@@ -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.debugger.streams.ui.impl;
 
 import com.intellij.debugger.engine.JavaValue;
@@ -38,8 +38,8 @@ import org.jetbrains.java.debugger.JavaDebuggerEditorsProvider;
 
 import javax.swing.tree.TreePath;
 import java.awt.*;
-import java.util.List;
 import java.util.*;
+import java.util.List;
 import java.util.stream.Collectors;
 
 import static com.intellij.util.ui.tree.TreeUtil.collectSelectedPaths;
@@ -142,9 +142,8 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
     return true;
   }
 
-  @Nullable
   @Override
-  public Color getFileColorForPath(@NotNull TreePath path) {
+  public @Nullable Color getFileColorForPath(@NotNull TreePath path) {
     if (isPathHighlighted(path)) {
       final Color background = UIUtil.getTreeSelectionBackground(true);
       return COLORS_CACHE.computeIfAbsent(background.getRGB(), rgb -> new JBColor(
@@ -162,8 +161,7 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
     myIgnoreInternalSelectionEvents = false;
   }
 
-  @Nullable
-  public Rectangle getRectByValue(@NotNull TraceElement element) {
+  public @Nullable Rectangle getRectByValue(@NotNull TraceElement element) {
     final TreePath path = myValue2Path.get(element);
     return path == null ? null : getPathBounds(path);
   }
@@ -255,8 +253,7 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
     }
   }
 
-  @NotNull
-  private Rectangle optimizeRowsCountInVisibleRect(int @NotNull [] rows) {
+  private @NotNull Rectangle optimizeRowsCountInVisibleRect(int @NotNull [] rows) {
     // a simple scan-line algorithm to find an optimal subset of visible rows (maximum)
     final Rectangle visibleRect = getVisibleRect();
     final int height = visibleRect.height;
@@ -347,7 +344,7 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
     }
   }
 
-  private final static class MyNodeManager extends NodeManagerImpl {
+  private static final class MyNodeManager extends NodeManagerImpl {
     MyNodeManager(Project project) {
       super(project, null);
     }
@@ -368,8 +365,7 @@ public class CollectionTree extends XDebuggerTree implements TraceContainer {
     }
   }
 
-  @NotNull
-  private TreePath getTopPath(@NotNull TreePath path) {
+  private @NotNull TreePath getTopPath(@NotNull TreePath path) {
     TreePath current = path;
     while (current != null && !myPath2Value.containsKey(current)) {
       current = current.getParentPath();
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionView.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionView.java
index 8e98f48e0c7e..3b4c48c2f374 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionView.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/CollectionView.java
@@ -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.debugger.streams.ui.impl;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -72,8 +72,7 @@ public class CollectionView extends JPanel implements TraceContainer {
     return myInstancesTree.highlightedExists();
   }
 
-  @NotNull
-  protected CollectionTree getInstancesTree() {
+  protected @NotNull CollectionTree getInstancesTree() {
     return myInstancesTree;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java
index 41ca6f7d03df..818b06b52935 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/EvaluationAwareTraceWindow.java
@@ -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.debugger.streams.ui.impl;
 
 import com.intellij.CommonBundle;
@@ -95,9 +95,8 @@ public class EvaluationAwareTraceWindow extends DialogWrapper {
     init();
   }
 
-  @Nullable
   @Override
-  protected String getDimensionServiceKey() {
+  protected @Nullable String getDimensionServiceKey() {
     return "#com.intellij.debugger.streams.ui.EvaluationAwareTraceWindow";
   }
 
@@ -171,14 +170,12 @@ public class EvaluationAwareTraceWindow extends DialogWrapper {
     return new Action[]{new MyToggleViewAction()};
   }
 
-  @Nullable
   @Override
-  protected JComponent createCenterPanel() {
+  protected @Nullable JComponent createCenterPanel() {
     return myCenterPane;
   }
 
-  @NotNull
-  private List createControllers(@NotNull ResolvedTracingResult resolvedResult) {
+  private @NotNull List createControllers(@NotNull ResolvedTracingResult resolvedResult) {
     List controllers = new ArrayList<>();
     final ResolvedStreamChain chain = resolvedResult.getResolvedChain();
 
@@ -221,9 +218,7 @@ public class EvaluationAwareTraceWindow extends DialogWrapper {
     PropertiesComponent.getInstance().setValue(IS_FLAT_MODE_PROPERTY, MyMode.FLAT.equals(mode));
   }
 
-  @NotNull
-  @Nls
-  private static String getButtonText(@NotNull MyMode currentState) {
+  private static @NotNull @Nls String getButtonText(@NotNull MyMode currentState) {
     return MyMode.SPLIT.equals(currentState)
            ? StreamDebuggerBundle.message("stream.debugger.dialog.flat.mode.button")
            : StreamDebuggerBundle.message("stream.debugger.dialog.split.mode.button");
@@ -245,8 +240,7 @@ public class EvaluationAwareTraceWindow extends DialogWrapper {
       updateWindowMode(myCenterPane, myMode);
     }
 
-    @NotNull
-    private static MyMode toggleMode(@NotNull MyMode mode) {
+    private static @NotNull MyMode toggleMode(@NotNull MyMode mode) {
       return MyMode.FLAT.equals(mode) ? MyMode.SPLIT : MyMode.FLAT;
     }
   }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceControllerImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceControllerImpl.java
index dc56ccb5a012..1f6f8c231b62 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceControllerImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceControllerImpl.java
@@ -1,4 +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.debugger.streams.ui.impl;
 
 import com.intellij.debugger.streams.trace.IntermediateState;
@@ -60,40 +60,33 @@ public class TraceControllerImpl implements TraceController, Disposable {
     myNextListener = listener;
   }
 
-  @NotNull
   @Override
-  @Unmodifiable
-  public List getValues() {
+  public @NotNull @Unmodifiable List getValues() {
     return myState.getRawValues();
   }
 
   @Override
-  @NotNull
-  public List getTrace() {
+  public @NotNull List getTrace() {
     return myState.getTrace();
   }
 
-  @Nullable
   @Override
-  public StreamCall getNextCall() {
+  public @Nullable StreamCall getNextCall() {
     return myToNext == null ? null : myToNext.getNextCall();
   }
 
-  @Nullable
   @Override
-  public StreamCall getPrevCall() {
+  public @Nullable StreamCall getPrevCall() {
     return myToPrev == null ? null : myToPrev.getPrevCall();
   }
 
-  @NotNull
   @Override
-  public List getNextValues(@NotNull TraceElement element) {
+  public @NotNull List getNextValues(@NotNull TraceElement element) {
     return myToNext == null ? Collections.emptyList() : myToNext.getNextValues(element);
   }
 
-  @NotNull
   @Override
-  public List getPrevValues(@NotNull TraceElement element) {
+  public @NotNull List getPrevValues(@NotNull TraceElement element) {
     return myToPrev == null ? Collections.emptyList() : myToPrev.getPrevValues(element);
   }
 
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceTreeCellRenderer.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceTreeCellRenderer.java
index 877541204ceb..6b76623a862d 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceTreeCellRenderer.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/ui/impl/TraceTreeCellRenderer.java
@@ -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.debugger.streams.ui.impl;
 
 import com.intellij.openapi.project.Project;
@@ -41,7 +41,7 @@ public class TraceTreeCellRenderer extends ColoredTreeCellRenderer {
   }
 
   @Override
-  public void customizeCellRenderer(@NotNull final JTree tree,
+  public void customizeCellRenderer(final @NotNull JTree tree,
                                     final Object value,
                                     final boolean selected,
                                     final boolean expanded,
@@ -114,9 +114,8 @@ public class TraceTreeCellRenderer extends ColoredTreeCellRenderer {
     }
   }
 
-  @NotNull
   @Override
-  public Dimension getPreferredSize() {
+  public @NotNull Dimension getPreferredSize() {
     Dimension size = super.getPreferredSize();
     if (myHaveLink) {
       size.width += myLinkWidth;
@@ -124,9 +123,8 @@ public class TraceTreeCellRenderer extends ColoredTreeCellRenderer {
     return size;
   }
 
-  @Nullable
   @Override
-  public Object getFragmentTagAt(int x) {
+  public @Nullable Object getFragmentTagAt(int x) {
     if (myHaveLink) {
       return myLink.getFragmentTagAt(x - myLinkOffset);
     }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/TraceUtil.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/TraceUtil.java
index 5105c3d72da2..383dd2bb4d29 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/TraceUtil.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/TraceUtil.java
@@ -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.debugger.streams.wrapper;
 
 import com.intellij.debugger.streams.trace.TraceElement;
@@ -24,8 +24,7 @@ public final class TraceUtil {
     return values.stream().sorted(Comparator.comparing(TraceElement::getTime)).collect(Collectors.toList());
   }
 
-  @Nullable
-  public static Object extractKey(@NotNull TraceElement element) {
+  public static @Nullable Object extractKey(@NotNull TraceElement element) {
     final Value value = element.getValue();
     if (!(value instanceof PrimitiveValue)) return value;
     if (value instanceof IntegerValue) return ((IntegerValue)value).value();
@@ -39,17 +38,13 @@ public final class TraceUtil {
     throw new RuntimeException("unknown primitive value: " + value.type().name());
   }
 
-  @NotNull
-  @NlsSafe
-  public static String formatWithArguments(@NotNull MethodCall call) {
+  public static @NotNull @NlsSafe String formatWithArguments(@NotNull MethodCall call) {
     return call.getName() + StreamEx.of(call.getArguments())
       .map(x -> StringUtil.shortenTextWithEllipsis(x.getText().replaceAll("\\s", ""), 30, 5, THREE_DOTS))
       .joining(", ", "(", ")");
   }
 
-  @NotNull
-  @NlsSafe
-  public static String formatQualifierExpression(@NotNull String expression, int maxLength) {
+  public static @NotNull @NlsSafe String formatQualifierExpression(@NotNull String expression, int maxLength) {
     expression = expression.replaceAll("\\s", "").replaceAll(",", ", ");
     if (expression.length() < maxLength) return expression;
     if (expression.isEmpty()) return "qualifier";
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/CallArgumentImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/CallArgumentImpl.java
index 5060873ea49c..5b10f97c7c6f 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/CallArgumentImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/CallArgumentImpl.java
@@ -1,4 +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.debugger.streams.wrapper.impl;
 
 import com.intellij.debugger.streams.wrapper.CallArgument;
@@ -9,8 +9,8 @@ import org.jetbrains.annotations.NotNull;
  * @author Vitaliy.Bibaev
  */
 public class CallArgumentImpl implements CallArgument {
-  @NotNull private final String myType;
-  @NotNull private final String myText;
+  private final @NotNull String myType;
+  private final @NotNull String myText;
 
   public CallArgumentImpl(@NotNull String type, @NotNull String text) {
     myType = type;
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/IntermediateStreamCallImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/IntermediateStreamCallImpl.java
index bce6fedc2b1e..5e14cb5b757e 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/IntermediateStreamCallImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/IntermediateStreamCallImpl.java
@@ -1,4 +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.debugger.streams.wrapper.impl;
 
 import com.intellij.debugger.streams.trace.impl.handler.type.GenericType;
@@ -28,15 +28,13 @@ public class IntermediateStreamCallImpl extends StreamCallImpl implements Interm
     myTypeAfter = typeAfter;
   }
 
-  @NotNull
   @Override
-  public GenericType getTypeBefore() {
+  public @NotNull GenericType getTypeBefore() {
     return myTypeBefore;
   }
 
-  @NotNull
   @Override
-  public GenericType getTypeAfter() {
+  public @NotNull GenericType getTypeAfter() {
     return myTypeAfter;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamCallImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamCallImpl.java
index da97e7694f3a..cfca74d774c3 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamCallImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamCallImpl.java
@@ -1,4 +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.debugger.streams.wrapper.impl;
 
 import com.intellij.debugger.streams.wrapper.CallArgument;
@@ -29,9 +29,8 @@ public abstract class StreamCallImpl implements StreamCall {
     myTextRange = range;
   }
 
-  @NotNull
   @Override
-  public TextRange getTextRange() {
+  public @NotNull TextRange getTextRange() {
     return myTextRange;
   }
 
@@ -40,15 +39,13 @@ public abstract class StreamCallImpl implements StreamCall {
     return myName;
   }
 
-  @NotNull
   @Override
-  public List getArguments() {
+  public @NotNull List getArguments() {
     return myArgs;
   }
 
-  @NotNull
   @Override
-  public StreamCallType getType() {
+  public @NotNull StreamCallType getType() {
     return myType;
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamChainImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamChainImpl.java
index b7cf9256583f..d932be9fcdaf 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamChainImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/StreamChainImpl.java
@@ -1,4 +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.debugger.streams.wrapper.impl;
 
 import com.intellij.debugger.streams.wrapper.*;
@@ -30,21 +30,18 @@ public class StreamChainImpl implements StreamChain {
     myContext = context;
   }
 
-  @NotNull
   @Override
-  public QualifierExpression getQualifierExpression() {
+  public @NotNull QualifierExpression getQualifierExpression() {
     return myQualifierExpression;
   }
 
-  @NotNull
   @Override
-  public List getIntermediateCalls() {
+  public @NotNull List getIntermediateCalls() {
     return Collections.unmodifiableList(myIntermediateCalls);
   }
 
-  @NotNull
   @Override
-  public StreamCall getCall(int index) {
+  public @NotNull StreamCall getCall(int index) {
     if (0 <= index && index < length()) {
       return doGetCall(index);
     }
@@ -52,9 +49,8 @@ public class StreamChainImpl implements StreamChain {
     throw new IndexOutOfBoundsException("Call index out of bound: " + index);
   }
 
-  @NotNull
   @Override
-  public TerminatorStreamCall getTerminationCall() {
+  public @NotNull TerminatorStreamCall getTerminationCall() {
     return myTerminator;
   }
 
@@ -93,9 +89,8 @@ public class StreamChainImpl implements StreamChain {
     return 1 + myIntermediateCalls.size();
   }
 
-  @NotNull
   @Override
-  public PsiElement getContext() {
+  public @NotNull PsiElement getContext() {
     return myContext;
   }
 
@@ -107,8 +102,7 @@ public class StreamChainImpl implements StreamChain {
     return myTerminator;
   }
 
-  @NotNull
-  private static String args2Text(@NotNull List args) {
+  private static @NotNull String args2Text(@NotNull List args) {
     return StreamEx.of(args).map(CallArgument::getText).joining(", ", "(", ")");
   }
 }
diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/TerminatorStreamCallImpl.java b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/TerminatorStreamCallImpl.java
index 7a765cd2f407..7102809b99b3 100644
--- a/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/TerminatorStreamCallImpl.java
+++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/wrapper/impl/TerminatorStreamCallImpl.java
@@ -1,4 +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.debugger.streams.wrapper.impl;
 
 import com.intellij.debugger.streams.trace.impl.handler.type.GenericType;
@@ -27,15 +27,13 @@ public class TerminatorStreamCallImpl extends StreamCallImpl implements Terminat
     myReturnType = resultType;
   }
 
-  @NotNull
   @Override
-  public GenericType getTypeBefore() {
+  public @NotNull GenericType getTypeBefore() {
     return myTypeBefore;
   }
 
-  @NotNull
   @Override
-  public GenericType getResultType() {
+  public @NotNull GenericType getResultType() {
     return myReturnType;
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/BackgroundTaskGroup.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/BackgroundTaskGroup.java
index e35064d77695..98648759b906 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/BackgroundTaskGroup.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/BackgroundTaskGroup.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.application.ModalityState;
@@ -30,8 +30,8 @@ public class BackgroundTaskGroup extends BackgroundTaskQueue {
 
   private static final Logger LOG = Logger.getInstance(BackgroundTaskGroup.class);
 
-  @NotNull protected final List myExceptions = createLockFreeCopyOnWriteList();
-  @NotNull private final Project myProject;
+  protected final @NotNull List myExceptions = createLockFreeCopyOnWriteList();
+  private final @NotNull Project myProject;
 
   public BackgroundTaskGroup(@NotNull Project project, @ProgressTitle @NotNull String title) {
     super(project, title);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictState.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictState.java
index 929abe1c9a65..041e4d287396 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictState.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ConflictState.java
@@ -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 org.jetbrains.idea.svn;
 
 import icons.SvnIcons;
@@ -30,7 +30,7 @@ public enum ConflictState {
   private final boolean myProperty;
   private final @Nullable Icon myIcon;
 
-  ConflictState(final boolean tree, final boolean text, final boolean property, @Nullable final Icon icon) {
+  ConflictState(final boolean tree, final boolean text, final boolean property, final @Nullable Icon icon) {
     myTree = tree;
     myText = text;
     myProperty = property;
@@ -54,13 +54,11 @@ public enum ConflictState {
     return myProperty || myText || myTree;
   }
 
-  @Nullable
-  public Icon getIcon() {
+  public @Nullable Icon getIcon() {
     return myIcon;
   }
 
-  @Nls
-  public String getDescription() {
+  public @Nls String getDescription() {
     if (!isConflict()) return null;
 
     List conflicts = asList(
@@ -76,8 +74,7 @@ public enum ConflictState {
                        leftState.myProperty || rightState.myProperty);
   }
 
-  @NotNull
-  public static ConflictState getInstance(final boolean tree, final boolean text, final boolean property) {
+  public static @NotNull ConflictState getInstance(final boolean tree, final boolean text, final boolean property) {
     final ConflictState[] conflictStates = values();
     for (ConflictState state : conflictStates) {
       if ((state.isTree() == tree) && (state.isText() == text) && (state.isProperty() == property)) {
@@ -89,8 +86,7 @@ public enum ConflictState {
     return null;
   }
 
-  @NotNull
-  public static ConflictState from(@NotNull Status status) {
+  public static @NotNull ConflictState from(@NotNull Status status) {
     return getInstance(status.getTreeConflict() != null, status.is(StatusType.STATUS_CONFLICTED),
                        status.isProperty(StatusType.STATUS_CONFLICTED));
   }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
index 9854bb40513d..f85711f2aaf1 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.ui.SimpleListCellRenderer;
@@ -24,6 +24,6 @@ public class DepthCombo extends JComboBox {
     return (Depth)super.getSelectedItem();
   }
 
-  private final static Depth[] ourForUpdate = {Depth.UNKNOWN, Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
-  private final static Depth[] ourForCheckout = {Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
+  private static final Depth[] ourForUpdate = {Depth.UNKNOWN, Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
+  private static final Depth[] ourForCheckout = {Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java
index b5c86169123e..a7c807d3cb4a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ForNestedRootChecker.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vcs.impl.VcsRootIterator;
@@ -19,16 +19,15 @@ import static com.intellij.openapi.progress.ProgressManager.checkCanceled;
 
 public class ForNestedRootChecker {
 
-  @NotNull private final SvnVcs myVcs;
-  @NotNull private final VcsRootIterator myRootIterator;
+  private final @NotNull SvnVcs myVcs;
+  private final @NotNull VcsRootIterator myRootIterator;
 
   public ForNestedRootChecker(@NotNull SvnVcs vcs) {
     myVcs = vcs;
     myRootIterator = new VcsRootIterator(vcs.getProject(), vcs);
   }
 
-  @NotNull
-  public List getAllNestedWorkingCopies(@NotNull VirtualFile root) {
+  public @NotNull List getAllNestedWorkingCopies(@NotNull VirtualFile root) {
     LinkedList result = new LinkedList<>();
     LinkedList workItems = new LinkedList<>();
 
@@ -56,12 +55,12 @@ public class ForNestedRootChecker {
 
   private static final class VcsFileResolver {
 
-    @NotNull private final SvnVcs myVcs;
-    @NotNull private final VirtualFile myFile;
-    @NotNull private final File myIoFile;
-    @NotNull private final VirtualFile myRoot;
-    @Nullable private Info myInfo;
-    @Nullable private SvnBindException myError;
+    private final @NotNull SvnVcs myVcs;
+    private final @NotNull VirtualFile myFile;
+    private final @NotNull File myIoFile;
+    private final @NotNull VirtualFile myRoot;
+    private @Nullable Info myInfo;
+    private @Nullable SvnBindException myError;
 
     private VcsFileResolver(@NotNull SvnVcs vcs, @NotNull VirtualFile file, @NotNull VirtualFile root) {
       myVcs = vcs;
@@ -70,8 +69,7 @@ public class ForNestedRootChecker {
       myRoot = root;
     }
 
-    @Nullable
-    public Node resolve() {
+    public @Nullable Node resolve() {
       runInfo();
 
       return processInfo();
@@ -97,8 +95,7 @@ public class ForNestedRootChecker {
       return myFile.findChild(SvnUtil.SVN_ADMIN_DIR_NAME) != null;
     }
 
-    @Nullable
-    private Node processInfo() {
+    private @Nullable Node processInfo() {
       Node result = null;
 
       if (myError != null) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/GeneralSettingsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/GeneralSettingsPanel.java
index 6eb531e043a8..337e9248ab28 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/GeneralSettingsPanel.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/GeneralSettingsPanel.java
@@ -21,7 +21,7 @@ import static org.jetbrains.idea.svn.SvnUtil.USER_CONFIGURATION_PATH;
 
 public class GeneralSettingsPanel implements ConfigurableUi, Disposable {
 
-  @NotNull private final Project myProject;
+  private final @NotNull Project myProject;
 
   private JPanel myMainPanel;
 
@@ -58,9 +58,8 @@ public class GeneralSettingsPanel implements ConfigurableUi, D
     });
   }
 
-  @NotNull
   @Override
-  public JComponent getComponent() {
+  public @NotNull JComponent getComponent() {
     return myMainPanel;
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java
index 744ef77b5193..0856409e35af 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesBuilder.java
@@ -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 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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.util.io.FileUtil;
@@ -19,8 +19,8 @@ import static com.intellij.vcsUtil.VcsUtil.getFilePath;
 
 public class NestedCopiesBuilder implements StatusReceiver {
 
-  @NotNull private final Set myCopies;
-  @NotNull private final SvnVcs myVcs;
+  private final @NotNull Set myCopies;
+  private final @NotNull SvnVcs myVcs;
 
   public NestedCopiesBuilder(@NotNull SvnVcs vcs) {
     myVcs = vcs;
@@ -70,8 +70,7 @@ public class NestedCopiesBuilder implements StatusReceiver {
   public void finish() {
   }
 
-  @NotNull
-  public Set getCopies() {
+  public @NotNull Set getCopies() {
     return myCopies;
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesHolder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesHolder.java
index fdf78bc57c42..01c7f894743c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesHolder.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopiesHolder.java
@@ -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 org.jetbrains.idea.svn;
 
 import org.jetbrains.annotations.NotNull;
@@ -10,7 +10,7 @@ public class NestedCopiesHolder {
 
   private final Set mySet = new HashSet<>();
 
-  public synchronized void add(@NotNull final Set data) {
+  public synchronized void add(final @NotNull Set data) {
     mySet.addAll(data);
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopyInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopyInfo.java
index ad42e80ee227..42ff63994484 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopyInfo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/NestedCopyInfo.java
@@ -1,4 +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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vfs.VirtualFile;
@@ -7,16 +7,16 @@ import org.jetbrains.annotations.Nullable;
 import org.jetbrains.idea.svn.api.Url;
 
 public class NestedCopyInfo {
-  @NotNull private final VirtualFile myFile;
-  @Nullable private Url myUrl;
-  @NotNull private WorkingCopyFormat myFormat;
-  @NotNull private final NestedCopyType myType;
-  @Nullable private Url myRootURL;
+  private final @NotNull VirtualFile myFile;
+  private @Nullable Url myUrl;
+  private @NotNull WorkingCopyFormat myFormat;
+  private final @NotNull NestedCopyType myType;
+  private @Nullable Url myRootURL;
 
-  public NestedCopyInfo(@NotNull final VirtualFile file,
-                        @Nullable final Url url,
-                        @NotNull final WorkingCopyFormat format,
-                        @NotNull final NestedCopyType type,
+  public NestedCopyInfo(final @NotNull VirtualFile file,
+                        final @Nullable Url url,
+                        final @NotNull WorkingCopyFormat format,
+                        final @NotNull NestedCopyType type,
                         @Nullable Url rootURL) {
     myFile = file;
     myUrl = url;
@@ -29,8 +29,7 @@ public class NestedCopyInfo {
     myUrl = url;
   }
 
-  @Nullable
-  public Url getRootURL() {
+  public @Nullable Url getRootURL() {
     return myRootURL;
   }
 
@@ -38,23 +37,19 @@ public class NestedCopyInfo {
     myFormat = format;
   }
 
-  @NotNull
-  public VirtualFile getFile() {
+  public @NotNull VirtualFile getFile() {
     return myFile;
   }
 
-  @Nullable
-  public Url getUrl() {
+  public @Nullable Url getUrl() {
     return myUrl;
   }
 
-  @NotNull
-  public WorkingCopyFormat getFormat() {
+  public @NotNull WorkingCopyFormat getFormat() {
     return myFormat;
   }
 
-  @NotNull
-  public NestedCopyType getType() {
+  public @NotNull NestedCopyType getType() {
     return myType;
   }
 
@@ -79,7 +74,7 @@ public class NestedCopyInfo {
     return key(myFile).hashCode();
   }
 
-  public void setRootURL(@Nullable final Url value) {
+  public void setRootURL(final @Nullable Url value) {
     myRootURL = value;
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/NetworkSettingsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/NetworkSettingsPanel.java
index f22bdabc3a8e..ab6f13b2a480 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/NetworkSettingsPanel.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/NetworkSettingsPanel.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.ide.DataManager;
@@ -17,7 +17,7 @@ import javax.swing.*;
 
 public class NetworkSettingsPanel implements ConfigurableUi {
 
-  @NotNull private final Project myProject;
+  private final @NotNull Project myProject;
 
   private JPanel myMainPanel;
   private JCheckBox myUseCommonProxy;
@@ -59,9 +59,8 @@ public class NetworkSettingsPanel implements ConfigurableUi {
     myAllRadioButton.setEnabled(true);
   }
 
-  @NotNull
   @Override
-  public JComponent getComponent() {
+  public @NotNull JComponent getComponent() {
     return myMainPanel;
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java
index 12285d537415..d029f5add60d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/Node.java
@@ -1,4 +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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vfs.VfsUtilCore;
@@ -14,10 +14,10 @@ import java.io.File;
 // TODO: provides RepositoryLocation
 public class Node {
 
-  @NotNull private final VirtualFile myFile;
-  @NotNull private final Url myUrl;
-  @NotNull private final Url myRepositoryUrl;
-  @Nullable private final SvnBindException myError;
+  private final @NotNull VirtualFile myFile;
+  private final @NotNull Url myUrl;
+  private final @NotNull Url myRepositoryUrl;
+  private final @Nullable SvnBindException myError;
 
   public Node(@NotNull VirtualFile file, @NotNull Url url, @NotNull Url repositoryUrl) {
     this(file, url, repositoryUrl, null);
@@ -30,28 +30,23 @@ public class Node {
     myError = error;
   }
 
-  @NotNull
-  public VirtualFile getFile() {
+  public @NotNull VirtualFile getFile() {
     return myFile;
   }
 
-  @NotNull
-  public File getIoFile() {
+  public @NotNull File getIoFile() {
     return VfsUtilCore.virtualToIoFile(getFile());
   }
 
-  @NotNull
-  public Url getUrl() {
+  public @NotNull Url getUrl() {
     return myUrl;
   }
 
-  @NotNull
-  public Url getRepositoryRootUrl() {
+  public @NotNull Url getRepositoryRootUrl() {
     return myRepositoryUrl;
   }
 
-  @Nullable
-  public SvnBindException getError() {
+  public @Nullable SvnBindException getError() {
     return myError;
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/PresentationSettingsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/PresentationSettingsPanel.java
index 6541c67d0259..da51d51bc2ab 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/PresentationSettingsPanel.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/PresentationSettingsPanel.java
@@ -1,18 +1,4 @@
-/*
- * Copyright 2000-2017 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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.options.ConfigurableUi;
@@ -23,7 +9,7 @@ import javax.swing.*;
 
 public class PresentationSettingsPanel implements ConfigurableUi {
 
-  @NotNull private final Project myProject;
+  private final @NotNull Project myProject;
 
   private JPanel myMainPanel;
 
@@ -42,9 +28,8 @@ public class PresentationSettingsPanel implements ConfigurableUi implements Forceable {
     private final K myKey;
     private final KeyDescriptor myDescriptor;
 
-    private KeyWrapper(@NotNull final KeyDescriptor descriptor, final K key) {
+    private KeyWrapper(final @NotNull KeyDescriptor descriptor, final K key) {
       myDescriptor = descriptor;
       myKey = key;
     }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBaseContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBaseContentRevision.java
index d795c15178a1..b6ce2816724e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBaseContentRevision.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBaseContentRevision.java
@@ -1,18 +1,4 @@
-/*
- * Copyright 2000-2016 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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vcs.FilePath;
@@ -21,17 +7,16 @@ import org.jetbrains.annotations.NotNull;
 
 public abstract class SvnBaseContentRevision implements ContentRevision {
 
-  @NotNull protected final SvnVcs myVcs;
-  @NotNull protected final FilePath myFile;
+  protected final @NotNull SvnVcs myVcs;
+  protected final @NotNull FilePath myFile;
 
   protected SvnBaseContentRevision(@NotNull SvnVcs vcs, @NotNull FilePath file) {
     myVcs = vcs;
     myFile = file;
   }
 
-  @NotNull
   @Override
-  public FilePath getFile() {
+  public @NotNull FilePath getFile() {
     return myFile;
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBinaryContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBinaryContentRevision.java
index 03865bdc1efe..42edd6c2a790 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBinaryContentRevision.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBinaryContentRevision.java
@@ -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 org.jetbrains.idea.svn;
 
@@ -22,8 +22,7 @@ class SvnBinaryContentRevision extends SvnContentRevision implements BinaryConte
   }
 
   @Override
-  @NonNls
-  public String toString() {
+  public @NonNls String toString() {
     return "SvnBinaryContentRevision:" + myFile;
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java
index 3602afe970bf..807831aee898 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java
@@ -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 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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.application.ReadAction;
@@ -12,7 +12,6 @@ import com.intellij.openapi.vcs.FileStatus;
 import com.intellij.openapi.vcs.VcsException;
 import com.intellij.openapi.vcs.changes.*;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.EventDispatcher;
 import com.intellij.vcsUtil.VcsUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -37,7 +36,7 @@ public class SvnChangeProvider implements ChangeProvider {
   private static final Logger LOG = Logger.getInstance(SvnChangeProvider.class);
   public static final @NonNls String PROPERTY_LAYER = "Property";
 
-  @NotNull private final SvnVcs myVcs;
+  private final @NotNull SvnVcs myVcs;
 
   public SvnChangeProvider(@NotNull SvnVcs vcs) {
     myVcs = vcs;
@@ -179,7 +178,7 @@ public class SvnChangeProvider implements ChangeProvider {
 
   private void applyMovedChange(@NotNull SvnChangeProviderContext context,
                                 @NotNull FilePath oldPath,
-                                @Nullable final VcsDirtyScope dirtyScope,
+                                final @Nullable VcsDirtyScope dirtyScope,
                                 @NotNull Set movedFiles,
                                 @NotNull SvnChangedFile deletedFile,
                                 @Nullable Status copiedStatus,
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java
index 36dc816283f7..bfe13af0b05c 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProviderContext.java
@@ -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 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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.diagnostic.Logger;
@@ -40,17 +40,17 @@ import static org.jetbrains.idea.svn.SvnUtil.getRelativePath;
 class SvnChangeProviderContext implements StatusReceiver {
   private static final Logger LOG = Logger.getInstance(SvnChangeProviderContext.class);
 
-  @NotNull private final ChangelistBuilder myChangelistBuilder;
-  @NotNull private final List myCopiedFiles = new ArrayList<>();
-  @NotNull private final List myDeletedFiles = new ArrayList<>();
+  private final @NotNull ChangelistBuilder myChangelistBuilder;
+  private final @NotNull List myCopiedFiles = new ArrayList<>();
+  private final @NotNull List myDeletedFiles = new ArrayList<>();
   // for files moved in a subtree, which were the targets of merge (for instance).
-  @NotNull private final Map myTreeConflicted = new HashMap<>();
-  @NotNull private final Map myCopyFromURLs = new HashMap<>();
-  @NotNull private final SvnVcs myVcs;
+  private final @NotNull Map myTreeConflicted = new HashMap<>();
+  private final @NotNull Map myCopyFromURLs = new HashMap<>();
+  private final @NotNull SvnVcs myVcs;
   private final SvnBranchConfigurationManager myBranchConfigurationManager;
-  @NotNull private final List filesToRefresh = new ArrayList<>();
+  private final @NotNull List filesToRefresh = new ArrayList<>();
 
-  @Nullable private final ProgressIndicator myProgress;
+  private final @Nullable ProgressIndicator myProgress;
 
   SvnChangeProviderContext(@NotNull SvnVcs vcs, @NotNull ChangelistBuilder changelistBuilder, @Nullable ProgressIndicator progress) {
     myVcs = vcs;
@@ -89,8 +89,7 @@ class SvnChangeProviderContext implements StatusReceiver {
     LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh, true, false, null);
   }
 
-  @NotNull
-  public ChangelistBuilder getBuilder() {
+  public @NotNull ChangelistBuilder getBuilder() {
     return myChangelistBuilder;
   }
 
@@ -98,18 +97,15 @@ class SvnChangeProviderContext implements StatusReceiver {
     myTreeConflicted.put(status.getFile().getAbsolutePath(), status);
   }
 
-  @Nullable
-  public Status getTreeConflictStatus(@NotNull File file) {
+  public @Nullable Status getTreeConflictStatus(@NotNull File file) {
     return myTreeConflicted.get(file.getAbsolutePath());
   }
 
-  @NotNull
-  public List getCopiedFiles() {
+  public @NotNull List getCopiedFiles() {
     return myCopiedFiles;
   }
 
-  @NotNull
-  public List getDeletedFiles() {
+  public @NotNull List getDeletedFiles() {
     return myDeletedFiles;
   }
 
@@ -134,8 +130,7 @@ class SvnChangeProviderContext implements StatusReceiver {
    * @param filePath the original filepath
    * @return the copy source url, or null if the file isn't a copy of anything
    */
-  @Nullable
-  public Url getParentCopyFromURL(@NotNull FilePath filePath) throws SvnBindException {
+  public @Nullable Url getParentCopyFromURL(@NotNull FilePath filePath) throws SvnBindException {
     Url result = null;
     FilePath parent = filePath;
 
@@ -328,11 +323,10 @@ class SvnChangeProviderContext implements StatusReceiver {
     return change;
   }
 
-  @NotNull
-  private Change createChange(@Nullable ContentRevision before,
-                              @Nullable ContentRevision after,
-                              @NotNull FileStatus fStatus,
-                              @NotNull Status svnStatus) {
+  private @NotNull Change createChange(@Nullable ContentRevision before,
+                                       @Nullable ContentRevision after,
+                                       @NotNull FileStatus fStatus,
+                                       @NotNull Status svnStatus) {
     ConflictedSvnChange change =
       new ConflictedSvnChange(before, after, fStatus, getState(svnStatus), after == null ? before.getFile() : after.getFile());
 
@@ -356,8 +350,7 @@ class SvnChangeProviderContext implements StatusReceiver {
     change.addAdditionalLayerElement(SvnChangeProvider.PROPERTY_LAYER, new Change(before, after, status));
   }
 
-  @Nullable
-  private PropertyRevision createBeforePropertyRevision(@NotNull Change change, @NotNull Status svnStatus, @Nullable Status deletedStatus) {
+  private @Nullable PropertyRevision createBeforePropertyRevision(@NotNull Change change, @NotNull Status svnStatus, @Nullable Status deletedStatus) {
     if (svnStatus.isProperty(StatusType.STATUS_ADDED) && deletedStatus == null) return null;
 
     ContentRevision before = change.getBeforeRevision();
@@ -369,8 +362,7 @@ class SvnChangeProviderContext implements StatusReceiver {
     return new SvnLazyPropertyContentRevision(myVcs, path, before.getRevisionNumber(), target);
   }
 
-  @Nullable
-  private PropertyRevision createAfterPropertyRevision(@NotNull Change change, @NotNull Status svnStatus) {
+  private @Nullable PropertyRevision createAfterPropertyRevision(@NotNull Change change, @NotNull Status svnStatus) {
     if (svnStatus.isProperty(StatusType.STATUS_DELETED)) return null;
 
     ContentRevision after = change.getAfterRevision();
@@ -381,8 +373,7 @@ class SvnChangeProviderContext implements StatusReceiver {
     return new SvnLazyPropertyContentRevision(myVcs, path, after.getRevisionNumber(), target);
   }
 
-  @NotNull
-  private ConflictState getState(@Nullable Status svnStatus) {
+  private @NotNull ConflictState getState(@Nullable Status svnStatus) {
     ConflictState result = svnStatus != null ? ConflictState.from(svnStatus) : ConflictState.none;
 
     if (result.isTree()) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java
index 6245434a51ee..7d2b9cc688f9 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangedFile.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vcs.FilePath;
@@ -10,9 +10,9 @@ import org.jetbrains.idea.svn.status.Status;
 
 class SvnChangedFile {
 
-  @NotNull private final FilePath myFilePath;
-  @NotNull private final Status myStatus;
-  @Nullable private final Url myCopyFromURL;
+  private final @NotNull FilePath myFilePath;
+  private final @NotNull Status myStatus;
+  private final @Nullable Url myCopyFromURL;
 
   SvnChangedFile(@NotNull FilePath filePath, @NotNull Status status) {
     this(filePath, status, null);
@@ -24,18 +24,15 @@ class SvnChangedFile {
     myCopyFromURL = copyFromURL;
   }
 
-  @NotNull
-  public FilePath getFilePath() {
+  public @NotNull FilePath getFilePath() {
     return myFilePath;
   }
 
-  @NotNull
-  public Status getStatus() {
+  public @NotNull Status getStatus() {
     return myStatus;
   }
 
-  @Nullable
-  public Url getCopyFromURL() {
+  public @Nullable Url getCopyFromURL() {
     return ObjectUtils.chooseNotNull(myCopyFromURL, myStatus.getCopyFromUrl());
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java
index 9b90396053f4..44f4426a6e6d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangelistListener.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.diagnostic.Logger;
@@ -24,10 +24,10 @@ import java.util.List;
 import java.util.Objects;
 
 public class SvnChangelistListener implements ChangeListListener {
-  private final static Logger LOG = Logger.getInstance(SvnChangelistListener.class);
+  private static final Logger LOG = Logger.getInstance(SvnChangelistListener.class);
 
-  @NotNull private final SvnVcs myVcs;
-  @NotNull private final Condition myUnderSvnCondition;
+  private final @NotNull SvnVcs myVcs;
+  private final @NotNull Condition myUnderSvnCondition;
 
   public SvnChangelistListener(@NotNull SvnVcs vcs) {
     myVcs = vcs;
@@ -58,9 +58,7 @@ public class SvnChangelistListener implements ChangeListListener {
     removeFromChangeList(list.getChanges());
   }
 
-  @NotNull
-  @Unmodifiable
-  private List getPathsFromChanges(@NotNull Collection changes) {
+  private @NotNull @Unmodifiable List getPathsFromChanges(@NotNull Collection changes) {
     return ContainerUtil.findAll(ChangesUtil.getPaths(changes), myUnderSvnCondition);
   }
 
@@ -90,8 +88,7 @@ public class SvnChangelistListener implements ChangeListListener {
     addToChangeList(toList.getName(), changes, fromLists);
   }
 
-  @Nullable
-  public static String getCurrentMapping(@NotNull SvnVcs vcs, @NotNull File file) {
+  public static @Nullable String getCurrentMapping(@NotNull SvnVcs vcs, @NotNull File file) {
     try {
       final Status status = vcs.getFactory(file).createStatusClient().doStatus(file, false);
       return status == null ? null : status.getChangeListName();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnCompatibilityChecker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnCompatibilityChecker.java
index 36d28812dbf1..d45341260d48 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnCompatibilityChecker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnCompatibilityChecker.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.Disposable;
@@ -22,9 +22,9 @@ import static org.jetbrains.idea.svn.SvnBundle.message;
 @Service(Service.Level.PROJECT)
 final class SvnCompatibilityChecker implements Disposable {
   private final Project myProject;
-  private final static long ourFrequency = 10;
-  private final static long ourInvocationMax = 10;
-  private final static long ourInitCounter = 3;
+  private static final long ourFrequency = 10;
+  private static final long ourInvocationMax = 10;
+  private static final long ourInitCounter = 3;
 
   private long myCounter = 0;
   private long myDownStartCounter = ourInitCounter;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
index 59fd0b42da37..8154f130f580 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
@@ -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 org.jetbrains.idea.svn;
@@ -28,8 +28,8 @@ public abstract class SvnConfigurable extends ConfigurableBase> myUiSupplier;
+  private final @NotNull Project myProject;
+  private final @NotNull Supplier> myUiSupplier;
 
   public static @NlsContexts.ConfigurableName @NotNull String getGroupDisplayName() {
     return SvnVcs.VCS_DISPLAY_NAME;
@@ -57,9 +57,8 @@ public abstract class SvnConfigurable extends ConfigurableBase dirConsumer,
+                                                  final @NotNull Consumer dirConsumer,
                                                   final Project project,
-                                                  @Nullable final Component component) {
+                                                  final @Nullable Component component) {
     FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor()
       .withTitle(message("dialog.title.select.configuration.directory"))
       .withDescription(message("dialog.description.select.configuration.directory"))
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
index d25803e196d2..e86a8bec8829 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.Disposable;
@@ -34,15 +34,14 @@ import static org.jetbrains.idea.svn.config.SvnIniFile.SERVERS_FILE_NAME;
 
 @State(name = "SvnConfiguration", storages = @Storage(StoragePathMacros.WORKSPACE_FILE), reportStatistic = false)
 public class SvnConfiguration implements PersistentStateComponent, Disposable {
-  public final static int ourMaxAnnotateRevisionsDefault = 500;
+  public static final int ourMaxAnnotateRevisionsDefault = 500;
 
-  private final static long UPGRADE_TO_15_VERSION_ASKED = 123;
-  private final static long CHANGELIST_SUPPORT = 124;
-  private final static long UPGRADE_TO_16_VERSION_ASKED = 125;
+  private static final long UPGRADE_TO_15_VERSION_ASKED = 123;
+  private static final long CHANGELIST_SUPPORT = 124;
+  private static final long UPGRADE_TO_16_VERSION_ASKED = 125;
 
   private final Project myProject;
-  @NotNull
-  private SvnConfigurationState myState = new SvnConfigurationState();
+  private @NotNull SvnConfigurationState myState = new SvnConfigurationState();
 
   private SvnAuthenticationManager myAuthManager;
   private SvnAuthenticationManager myPassiveAuthManager;
@@ -56,9 +55,8 @@ public class SvnConfiguration implements PersistentStateComponent myKeys = new TreeSet<>();
-    @NotNull private final Map myStorage = new HashMap<>();
+    private final @NotNull TreeSet myKeys = new TreeSet<>();
+    private final @NotNull Map myStorage = new HashMap<>();
 
-    @NotNull
-    public static String getKey(@NotNull String type, @NotNull String realm) {
+    public static @NotNull String getKey(@NotNull String type, @NotNull String realm) {
       return type + "$" + realm;
     }
 
@@ -411,8 +403,7 @@ public class SvnConfiguration implements PersistentStateComponent usual current revision content class can't be used
@@ -36,22 +36,19 @@ public class SvnContentRevision extends SvnBaseContentRevision implements ByteBa
     myUseBaseRevision = useBaseRevision;
   }
 
-  @NotNull
-  public static SvnContentRevision createBaseRevision(@NotNull SvnVcs vcs, @NotNull FilePath file, @NotNull Status status) {
+  public static @NotNull SvnContentRevision createBaseRevision(@NotNull SvnVcs vcs, @NotNull FilePath file, @NotNull Status status) {
     Revision revision = status.getRevision().isValid() ? status.getRevision() : status.getCommitInfo().getRevision();
     return createBaseRevision(vcs, file, revision);
   }
 
-  @NotNull
-  public static SvnContentRevision createBaseRevision(@NotNull SvnVcs vcs, @NotNull FilePath file, @NotNull Revision revision) {
+  public static @NotNull SvnContentRevision createBaseRevision(@NotNull SvnVcs vcs, @NotNull FilePath file, @NotNull Revision revision) {
     if (file.getFileType().isBinary()) {
       return new SvnBinaryContentRevision(vcs, file, revision, true);
     }
     return new SvnContentRevision(vcs, file, revision, true);
   }
 
-  @NotNull
-  public static SvnContentRevision createRemote(@NotNull SvnVcs vcs, @NotNull FilePath file, @NotNull Revision revision) {
+  public static @NotNull SvnContentRevision createRemote(@NotNull SvnVcs vcs, @NotNull FilePath file, @NotNull Revision revision) {
     if (file.getFileType().isBinary()) {
       return new SvnBinaryContentRevision(vcs, file, revision, false);
     }
@@ -59,8 +56,7 @@ public class SvnContentRevision extends SvnBaseContentRevision implements ByteBa
   }
 
   @Override
-  @Nullable
-  public String getContent() throws VcsException {
+  public @Nullable String getContent() throws VcsException {
     return ContentRevisionCache.getAsString(getContentAsBytes(), myFile, null);
   }
 
@@ -102,14 +98,12 @@ public class SvnContentRevision extends SvnBaseContentRevision implements ByteBa
   }
 
   @Override
-  @NotNull
-  public VcsRevisionNumber getRevisionNumber() {
+  public @NotNull VcsRevisionNumber getRevisionNumber() {
     return new SvnRevisionNumber(myRevision);
   }
 
   @Override
-  @NonNls
-  public String toString() {
+  public @NonNls String toString() {
     return myFile.getPath();
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java
index e652a2e80142..6022e6de01e7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnDiffProvider.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.diagnostic.Logger;
@@ -41,22 +41,20 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
   public static final String COMMIT_MESSAGE = "svn:log";
   private static final int BATCH_INFO_SIZE = 20;
 
-  @NotNull private final SvnVcs myVcs;
+  private final @NotNull SvnVcs myVcs;
 
   public SvnDiffProvider(@NotNull SvnVcs vcs) {
     myVcs = vcs;
   }
 
-  @Nullable
   @Override
-  public VcsRevisionNumber getCurrentRevision(@NotNull VirtualFile file) {
+  public @Nullable VcsRevisionNumber getCurrentRevision(@NotNull VirtualFile file) {
     final Info svnInfo = myVcs.getInfo(virtualToIoFile(file));
 
     return getRevision(svnInfo);
   }
 
-  @Nullable
-  private static VcsRevisionNumber getRevision(@Nullable Info info) {
+  private static @Nullable VcsRevisionNumber getRevision(@Nullable Info info) {
     VcsRevisionNumber result = null;
 
     if (info != null) {
@@ -70,9 +68,8 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
     return result;
   }
 
-  @NotNull
   @Override
-  public Map getCurrentRevisions(@NotNull Iterable files) {
+  public @NotNull Map getCurrentRevisions(@NotNull Iterable files) {
     Map result = new HashMap<>();
     Map items = new HashMap<>();
     List ioFiles = new ArrayList<>();
@@ -101,9 +98,8 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
     myVcs.collectInfo(ioFiles, createInfoHandler(revisionMap, fileMap));
   }
 
-  @NotNull
-  private static InfoConsumer createInfoHandler(@NotNull final Map revisionMap,
-                                                @NotNull final Map fileMap) {
+  private static @NotNull InfoConsumer createInfoHandler(final @NotNull Map revisionMap,
+                                                         final @NotNull Map fileMap) {
     return info -> {
       if (info != null) {
         VirtualFile file = fileMap.get(info.getFile().getAbsolutePath());
@@ -118,14 +114,12 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
     };
   }
 
-  @Nullable
   @Override
-  public VcsRevisionDescription getCurrentRevisionDescription(@NotNull VirtualFile file) {
+  public @Nullable VcsRevisionDescription getCurrentRevisionDescription(@NotNull VirtualFile file) {
     return getCurrentRevisionDescription(virtualToIoFile(file));
   }
 
-  @Nullable
-  private VcsRevisionDescription getCurrentRevisionDescription(@NotNull File path) {
+  private @Nullable VcsRevisionDescription getCurrentRevisionDescription(@NotNull File path) {
     final Info svnInfo = myVcs.getInfo(path);
     if (svnInfo == null) {
       return null;
@@ -143,8 +137,7 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
                                           svnInfo.getCommitInfo().getAuthor(), getCommitMessage(path, svnInfo));
   }
 
-  @Nullable
-  private String getCommitMessage(@NotNull File path, @NotNull Info info) {
+  private @Nullable String getCommitMessage(@NotNull File path, @NotNull Info info) {
     String result;
 
     try {
@@ -161,25 +154,21 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
     return result;
   }
 
-  @NotNull
-  private static ItemLatestState defaultResult() {
+  private static @NotNull ItemLatestState defaultResult() {
     return createResult(Revision.HEAD, true, true);
   }
 
-  @NotNull
-  private static ItemLatestState createResult(@NotNull Revision revision, boolean exists, boolean defaultHead) {
+  private static @NotNull ItemLatestState createResult(@NotNull Revision revision, boolean exists, boolean defaultHead) {
     return new ItemLatestState(new SvnRevisionNumber(revision), exists, defaultHead);
   }
 
-  @NotNull
   @Override
-  public ItemLatestState getLastRevision(@NotNull VirtualFile file) {
+  public @NotNull ItemLatestState getLastRevision(@NotNull VirtualFile file) {
     return getLastRevision(virtualToIoFile(file));
   }
 
-  @NotNull
   @Override
-  public ContentRevision createFileContent(@NotNull VcsRevisionNumber revisionNumber, @NotNull VirtualFile selectedFile) {
+  public @NotNull ContentRevision createFileContent(@NotNull VcsRevisionNumber revisionNumber, @NotNull VirtualFile selectedFile) {
     FilePath filePath = VcsUtil.getFilePath(selectedFile);
     Revision revision = ((SvnRevisionNumber)revisionNumber).getRevision();
 
@@ -195,8 +184,7 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
            : SvnContentRevision.createRemote(myVcs, filePath, revision);
   }
 
-  @Nullable
-  private Status getFileStatus(@NotNull File file, boolean remote) {
+  private @Nullable Status getFileStatus(@NotNull File file, boolean remote) {
     Status result = null;
 
     try {
@@ -209,22 +197,19 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
     return result;
   }
 
-  @NotNull
   @Override
-  public ItemLatestState getLastRevision(@NotNull FilePath filePath) {
+  public @NotNull ItemLatestState getLastRevision(@NotNull FilePath filePath) {
     return getLastRevision(filePath.getIOFile());
   }
 
-  @Nullable
   @Override
-  public VcsRevisionNumber getLatestCommittedRevision(@NotNull VirtualFile vcsRoot) {
+  public @Nullable VcsRevisionNumber getLatestCommittedRevision(@NotNull VirtualFile vcsRoot) {
     Info info = myVcs.getInfo(virtualToIoFile(vcsRoot), Revision.HEAD);
 
     return info != null ? new SvnRevisionNumber(info.getCommitInfo().getRevision()) : null;
   }
 
-  @NotNull
-  private ItemLatestState getLastRevision(@NotNull File file) {
+  private @NotNull ItemLatestState getLastRevision(@NotNull File file) {
     Status svnStatus = getFileStatus(file, true);
 
     if (svnStatus == null || itemExists(svnStatus)) {
@@ -240,8 +225,7 @@ public class SvnDiffProvider extends DiffProviderEx implements DiffProvider, Dif
     return createResult(getLastExistingRevision(file, svnStatus), false, false);
   }
 
-  @NotNull
-  private Revision getLastExistingRevision(@NotNull File file, @NotNull Status svnStatus) {
+  private @NotNull Revision getLastExistingRevision(@NotNull File file, @NotNull Status svnStatus) {
     WorkingCopyFormat format = myVcs.getWorkingCopyFormat(file);
     long revision = -1;
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
index cfe650f46c7a..f1b233f92d18 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
@@ -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 org.jetbrains.idea.svn;
@@ -52,10 +52,10 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
   private static class AddedFileInfo {
     private final VirtualFile myDir;
     private final String myName;
-    @Nullable private final File myCopyFrom;
+    private final @Nullable File myCopyFrom;
     private final boolean myRecursive;
 
-    AddedFileInfo(@NotNull VirtualFile dir, @NotNull String name, @Nullable final File copyFrom, boolean recursive) {
+    AddedFileInfo(@NotNull VirtualFile dir, @NotNull String name, final @Nullable File copyFrom, boolean recursive) {
       myDir = dir;
       myName = name;
       myCopyFrom = copyFrom;
@@ -73,7 +73,7 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
     }
   }
 
-  @NotNull private final SvnVcs myVcs;
+  private final @NotNull SvnVcs myVcs;
 
   private final VcsShowConfirmationOption myAddConfirmation;
   private final VcsShowConfirmationOption myDeleteConfirmation;
@@ -83,7 +83,7 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
   private final List myMovedFiles = new ArrayList<>();
   private final List myMoveExceptions = new ArrayList<>();
   private final List myFilesToRefresh = new ArrayList<>();
-  @Nullable private File myStorageForUndo;
+  private @Nullable File myStorageForUndo;
   private final List> myUndoStorageContents = new ArrayList<>();
   private boolean myUndoingMove = false;
 
@@ -110,13 +110,11 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
     return VcsUtil.isFileForVcs(file, myVcs.getProject(), myVcs);
   }
 
-  @NotNull
-  private static VcsException handleMoveException(@NotNull VcsException e) {
+  private static @NotNull VcsException handleMoveException(@NotNull VcsException e) {
     return e instanceof SvnBindException && ((SvnBindException)e).contains(ErrorCode.ENTRY_EXISTS) ? createMoveTargetExistsError(e) : e;
   }
 
-  @NotNull
-  private static VcsException createMoveTargetExistsError(@NotNull Exception e) {
+  private static @NotNull VcsException createMoveTargetExistsError(@NotNull Exception e) {
     return new VcsException(Arrays.asList(
       message("error.target.of.move.operation.is.already.under.version.control"),
       message("error.move.have.not.been.performed"),
@@ -125,8 +123,7 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
   }
 
   @Override
-  @Nullable
-  public File copy(@NotNull final VirtualFile file, @NotNull final VirtualFile toDir, @NotNull final String copyName) {
+  public @Nullable File copy(final @NotNull VirtualFile file, final @NotNull VirtualFile toDir, final @NotNull String copyName) {
     if (!isMyVcs(toDir)) return null;
 
     startOperation(toDir);
@@ -166,8 +163,7 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
   /**
    * passed dir must be under VC control (it is assumed)
    */
-  @Nullable
-  private String getRepositoryUUID(@NotNull VirtualFile dir) {
+  private @Nullable String getRepositoryUUID(@NotNull VirtualFile dir) {
     try {
       final Info info1 = new RepeatSvnActionThroughBusy() {
         @Override
@@ -460,8 +456,7 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
     }
   }
 
-  @NotNull
-  private RepeatSvnActionThroughBusy createRevertAction(@NotNull final File file, final boolean recursive) {
+  private @NotNull RepeatSvnActionThroughBusy createRevertAction(final @NotNull File file, final boolean recursive) {
     return new RepeatSvnActionThroughBusy() {
       @Override
       protected void executeImpl() throws VcsException {
@@ -470,8 +465,7 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
     };
   }
 
-  @NotNull
-  private RepeatSvnActionThroughBusy createDeleteAction(@NotNull final File file, final boolean force) {
+  private @NotNull RepeatSvnActionThroughBusy createDeleteAction(final @NotNull File file, final boolean force) {
     return new RepeatSvnActionThroughBusy() {
       @Override
       protected void executeImpl() throws VcsException {
@@ -935,13 +929,11 @@ public class SvnFileSystemListener implements LocalFileOperationsHandler, Dispos
     runInBackground(message("progress.title.moving.files.in.subversion"), runnable);
   }
 
-  @NotNull
-  private static File getIOFile(@NotNull VirtualFile vf) {
+  private static @NotNull File getIOFile(@NotNull VirtualFile vf) {
     return virtualToIoFile(vf).getAbsoluteFile();
   }
 
-  @Nullable
-  private Status getFileStatus(@NotNull final File file) {
+  private @Nullable Status getFileStatus(final @NotNull File file) {
     try {
       return new RepeatSvnActionThroughBusy() {
         @Override
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java
index f535d6de3b2f..c58e4451c1e7 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileUrlMappingImpl.java
@@ -56,7 +56,7 @@ public final class SvnFileUrlMappingImpl implements SvnFileUrlMapping, Persisten
   private boolean myInitedReloaded;
 
   private final @NotNull MergingUpdateQueue refreshQueue;
-  @NotNull private final CoroutineScope coroutineScope;
+  private final @NotNull CoroutineScope coroutineScope;
 
   @SuppressWarnings("UnusedDeclaration")
   private SvnFileUrlMappingImpl(@NotNull Project project, @NotNull CoroutineScope coroutineScope) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFormatSelector.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFormatSelector.java
index 0996b054da2d..09f5a127f1d8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFormatSelector.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFormatSelector.java
@@ -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 org.jetbrains.idea.svn;
 
 import org.jetbrains.annotations.NotNull;
@@ -7,8 +7,7 @@ import java.io.File;
 
 public final class SvnFormatSelector {
 
-  @NotNull
-  public static WorkingCopyFormat findRootAndGetFormat(@NotNull File path) {
+  public static @NotNull WorkingCopyFormat findRootAndGetFormat(@NotNull File path) {
     File root = SvnUtil.getWorkingCopyRoot(path);
 
     return root != null ? SvnUtil.getFormat(root) : WorkingCopyFormat.UNKNOWN;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLocallyDeletedChange.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLocallyDeletedChange.java
index 7e14a2b2b324..4d2856e14622 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLocallyDeletedChange.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnLocallyDeletedChange.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vcs.FilePath;
@@ -10,7 +10,7 @@ import javax.swing.*;
 import static org.jetbrains.idea.svn.SvnBundle.message;
 
 public class SvnLocallyDeletedChange extends LocallyDeletedChange {
-  @NotNull private final ConflictState myConflictState;
+  private final @NotNull ConflictState myConflictState;
 
   public SvnLocallyDeletedChange(@NotNull FilePath path, @NotNull ConflictState state) {
     super(path);
@@ -29,8 +29,7 @@ public class SvnLocallyDeletedChange extends LocallyDeletedChange {
     return description != null ? message("label.locally.deleted.file.has.conflicts", description) : null;
   }
 
-  @NotNull
-  public ConflictState getConflictState() {
+  public @NotNull ConflictState getConflictState() {
     return myConflictState;
   }
 }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java
index d8969f3c4c97..845bec1d9731 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnMapping.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.util.ClearableLazyValue;
@@ -18,14 +18,13 @@ import static com.intellij.util.containers.ContainerUtil.map;
 public class SvnMapping {
   private static final Comparator FILE_PATHS_COMPARATOR = (path1, path2) -> comparePaths(path1, path2);
 
-  @NotNull private final List myLonelyRoots = new ArrayList<>();
-  @NotNull private final TreeMap myFile2UrlMap = new TreeMap<>(FILE_PATHS_COMPARATOR);
-  @NotNull private final Map myUrl2FileMap = new HashMap<>();
+  private final @NotNull List myLonelyRoots = new ArrayList<>();
+  private final @NotNull TreeMap myFile2UrlMap = new TreeMap<>(FILE_PATHS_COMPARATOR);
+  private final @NotNull Map myUrl2FileMap = new HashMap<>();
   // no additional info. for caching only (convert roots)
-  @NotNull private final ClearableLazyValue> myPreCalculatedUnderVcsRoots = new ClearableLazyValue<>() {
-    @NotNull
+  private final @NotNull ClearableLazyValue> myPreCalculatedUnderVcsRoots = new ClearableLazyValue<>() {
     @Override
-    protected List compute() {
+    protected @NotNull List compute() {
       return map(myFile2UrlMap.values(), RootUrlInfo::getVirtualFile);
     }
   };
@@ -50,34 +49,28 @@ public class SvnMapping {
     myUrl2FileMap.put(rootInfo.getUrl(), rootInfo);
   }
 
-  @NotNull
-  public List getUnderVcsRoots() {
+  public @NotNull List getUnderVcsRoots() {
     return myPreCalculatedUnderVcsRoots.getValue();
   }
 
-  @NotNull
-  public List getAllCopies() {
+  public @NotNull List getAllCopies() {
     return new ArrayList<>(myFile2UrlMap.values());
   }
 
-  @Nullable
-  public String getRootForPath(@NotNull String path) {
+  public @Nullable String getRootForPath(@NotNull String path) {
     return find(myFile2UrlMap.headMap(path, true).descendingKeySet(),
                 root -> SystemInfo.isFileSystemCaseSensitive ? path.startsWith(root) : startsWithIgnoreCase(path, root));
   }
 
-  @NotNull
-  public Collection getUrls() {
+  public @NotNull Collection getUrls() {
     return myUrl2FileMap.keySet();
   }
 
-  @Nullable
-  public RootUrlInfo byFile(@NotNull String path) {
+  public @Nullable RootUrlInfo byFile(@NotNull String path) {
     return myFile2UrlMap.get(path);
   }
 
-  @Nullable
-  public RootUrlInfo byUrl(@NotNull Url url) {
+  public @Nullable RootUrlInfo byUrl(@NotNull Url url) {
     return myUrl2FileMap.get(url);
   }
 
@@ -89,8 +82,7 @@ public class SvnMapping {
     myLonelyRoots.addAll(roots);
   }
 
-  @NotNull
-  public List getLonelyRoots() {
+  public @NotNull List getLonelyRoots() {
     return myLonelyRoots;
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java
index 48eac8fc9ff1..8a735799f399 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProgressCanceller.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.progress.ProcessCanceledException;
@@ -11,7 +11,7 @@ import org.jetbrains.idea.svn.api.ProgressTracker;
 import static com.intellij.util.ObjectUtils.chooseNotNull;
 
 public class SvnProgressCanceller implements ProgressTracker {
-  @Nullable private final ProgressIndicator myIndicator;
+  private final @Nullable ProgressIndicator myIndicator;
 
   public SvnProgressCanceller() {
     this(null);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
index 3924b84c2148..8b988a78c9b8 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.application.ReadAction;
@@ -35,14 +35,14 @@ import static com.intellij.vcsUtil.VcsUtil.getFilePath;
 public class SvnRecursiveStatusWalker {
   private static final Logger LOG = Logger.getInstance(SvnRecursiveStatusWalker.class);
 
-  @NotNull private final SvnVcs myVcs;
-  @NotNull private final Project myProject;
-  @NotNull private final ProjectLevelVcsManager myVcsManager;
-  @NotNull private final ChangeListManager myChangeListManager;
-  @Nullable private final ProgressIndicator myProgress;
-  @NotNull private final StatusReceiver myReceiver;
-  @NotNull private final LinkedList myQueue;
-  @NotNull private final MyHandler myHandler;
+  private final @NotNull SvnVcs myVcs;
+  private final @NotNull Project myProject;
+  private final @NotNull ProjectLevelVcsManager myVcsManager;
+  private final @NotNull ChangeListManager myChangeListManager;
+  private final @Nullable ProgressIndicator myProgress;
+  private final @NotNull StatusReceiver myReceiver;
+  private final @NotNull LinkedList myQueue;
+  private final @NotNull MyHandler myHandler;
 
   public SvnRecursiveStatusWalker(@NotNull SvnVcs vcs, @NotNull StatusReceiver receiver, @Nullable ProgressIndicator progress) {
     myVcs = vcs;
@@ -98,7 +98,7 @@ public class SvnRecursiveStatusWalker {
     }
   }
 
-  public boolean isIgnoredByVcs(@NotNull final VirtualFile vFile) {
+  public boolean isIgnoredByVcs(final @NotNull VirtualFile vFile) {
     return ReadAction.compute(() -> {
       if (myVcs.getProject().isDisposed()) throw new ProcessCanceledException();
       return myVcsManager.isIgnored(vFile);
@@ -127,9 +127,9 @@ public class SvnRecursiveStatusWalker {
   }
 
   private static final class MyItem {
-    @NotNull private final FilePath myPath;
-    @NotNull private final Depth myDepth;
-    @NotNull private final StatusClient myStatusClient;
+    private final @NotNull FilePath myPath;
+    private final @NotNull Depth myDepth;
+    private final @NotNull StatusClient myStatusClient;
     private final boolean myIsInnerCopyRoot;
 
     private MyItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot, @NotNull StatusClient statusClient) {
@@ -139,18 +139,15 @@ public class SvnRecursiveStatusWalker {
       myIsInnerCopyRoot = isInnerCopyRoot;
     }
 
-    @NotNull
-    public FilePath getPath() {
+    public @NotNull FilePath getPath() {
       return myPath;
     }
 
-    @NotNull
-    public Depth getDepth() {
+    public @NotNull Depth getDepth() {
       return myDepth;
     }
 
-    @NotNull
-    public StatusClient getClient() {
+    public @NotNull StatusClient getClient() {
       return myStatusClient;
     }
 
@@ -170,9 +167,8 @@ public class SvnRecursiveStatusWalker {
     VirtualFileVisitor.Option[] options = newDepth.equals(Depth.EMPTY) ? ar(SKIP_ROOT, ONE_LEVEL_DEEP) : new VirtualFileVisitor.Option[0];
 
     visitChildrenRecursively(vFile, new VirtualFileVisitor(options) {
-      @NotNull
       @Override
-      public Result visitFileEx(@NotNull VirtualFile file) {
+      public @NotNull Result visitFileEx(@NotNull VirtualFile file) {
         if (isIgnoredIdeaLevel(file)) {
           myReceiver.processIgnored(getFilePath(file));
           return SKIP_CHILDREN;
@@ -189,8 +185,7 @@ public class SvnRecursiveStatusWalker {
     });
   }
 
-  @NotNull
-  private MyItem createItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot) {
+  private @NotNull MyItem createItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot) {
     StatusClient statusClient = myVcs.getFactory(path.getIOFile()).createStatusClient();
 
     return new MyItem(path, depth, isInnerCopyRoot, statusClient);
@@ -213,8 +208,7 @@ public class SvnRecursiveStatusWalker {
       }
     }
 
-    @Nullable
-    public Status getCurrentItemStatus() {
+    public @Nullable Status getCurrentItemStatus() {
       Status result = null;
 
       try {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRevisionNumber.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRevisionNumber.java
index 8a183c8ba85a..77ed8e328986 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRevisionNumber.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRevisionNumber.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.openapi.vcs.history.LongRevisionNumber;
@@ -10,16 +10,14 @@ import org.jetbrains.idea.svn.api.Revision;
  * @author alex
  */
 public class SvnRevisionNumber implements VcsRevisionNumber, LongRevisionNumber {
-  @NotNull
-  private final Revision myRevision;
+  private final @NotNull Revision myRevision;
 
   public SvnRevisionNumber(@NotNull Revision revision) {
     myRevision = revision;
   }
 
-  @NotNull
   @Override
-  public String asString() {
+  public @NotNull String asString() {
     return myRevision.toString();
   }
 
@@ -44,8 +42,7 @@ public class SvnRevisionNumber implements VcsRevisionNumber, LongRevisionNumber
     return Revision.GENERAL_ORDER.compare(myRevision, rev);
   }
 
-  @NotNull
-  public Revision getRevision() {
+  public @NotNull Revision getRevision() {
     return myRevision;
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
index 085bdbc8b5b1..06dfe1d31ac6 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java
@@ -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 org.jetbrains.idea.svn;
 
 import com.intellij.notification.NotificationType;
@@ -60,11 +60,11 @@ import static com.intellij.util.containers.ContainerUtil.map2Array;
 import static java.util.Collections.emptyList;
 
 public final class SvnUtil {
-  @NonNls public static final String SVN_ADMIN_DIR_NAME =
+  public static final @NonNls String SVN_ADMIN_DIR_NAME =
     SystemInfo.isWindows && EnvironmentUtil.getValue("SVN_ASP_DOT_NET_HACK") != null ? "_svn" : ".svn";
-  @NonNls public static final String ENTRIES_FILE_NAME = "entries";
-  @NonNls public static final String WC_DB_FILE_NAME = "wc.db";
-  @NonNls public static final String PATH_TO_LOCK_FILE = SVN_ADMIN_DIR_NAME + "/lock";
+  public static final @NonNls String ENTRIES_FILE_NAME = "entries";
+  public static final @NonNls String WC_DB_FILE_NAME = "wc.db";
+  public static final @NonNls String PATH_TO_LOCK_FILE = SVN_ADMIN_DIR_NAME + "/lock";
 
   public static final NotNullLazyValue USER_CONFIGURATION_PATH = NotNullLazyValue.atomicLazy(() -> {
     return SystemInfo.isWindows
@@ -88,20 +88,17 @@ public final class SvnUtil {
 
   private SvnUtil() { }
 
-  @Nullable
-  public static String parseWarning(@NotNull String text) {
+  public static @Nullable String parseWarning(@NotNull String text) {
     Matcher matcher = WARNING_PATTERN.matcher(text);
     // currently treating only first warning
     return matcher.find() ? matcher.group() : null;
   }
 
-  @Nullable
-  public static Date parseDate(@Nullable String value) {
+  public static @Nullable Date parseDate(@Nullable String value) {
     return parseDate(value, true);
   }
 
-  @Nullable
-  public static Date parseDate(@Nullable String value, boolean logError) {
+  public static @Nullable Date parseDate(@Nullable String value, boolean logError) {
     if (value == null) return null;
 
     try {
@@ -119,21 +116,19 @@ public final class SvnUtil {
     return vcs.getInfo(file) != null;
   }
 
-  @NotNull
-  public static Collection crawlWCRoots(@NotNull SvnVcs vcs,
-                                                     @NotNull File path,
-                                                     @NotNull SvnWCRootCrawler callback,
-                                                     @Nullable ProgressIndicator progress) {
+  public static @NotNull Collection crawlWCRoots(@NotNull SvnVcs vcs,
+                                                              @NotNull File path,
+                                                              @NotNull SvnWCRootCrawler callback,
+                                                              @Nullable ProgressIndicator progress) {
     VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(path);
 
     return file != null ? crawlWCRoots(vcs, file, callback, progress) : emptyList();
   }
 
-  @NotNull
-  private static Collection crawlWCRoots(@NotNull SvnVcs vcs,
-                                                      @NotNull VirtualFile file,
-                                                      @NotNull SvnWCRootCrawler callback,
-                                                      @Nullable ProgressIndicator progress) {
+  private static @NotNull Collection crawlWCRoots(@NotNull SvnVcs vcs,
+                                                               @NotNull VirtualFile file,
+                                                               @NotNull SvnWCRootCrawler callback,
+                                                               @Nullable ProgressIndicator progress) {
     Set result = new HashSet<>();
     // TODO: Actually it is not OK to call getParent() if file is invalid.
     VirtualFile parent = !file.isDirectory() || !file.isValid() ? file.getParent() : file;
@@ -303,15 +298,13 @@ public final class SvnUtil {
     }
   }
 
-  @NotNull
-  public static MultiMap, Change> splitChangesIntoWc(@NotNull SvnVcs vcs, @NotNull List changes) {
+  public static @NotNull MultiMap, Change> splitChangesIntoWc(@NotNull SvnVcs vcs, @NotNull List changes) {
     return splitIntoRepositoriesMap(vcs, changes, change -> ChangesUtil.getFilePath(change));
   }
 
-  @NotNull
-  public static  MultiMap, T> splitIntoRepositoriesMap(@NotNull final SvnVcs vcs,
-                                                                                       @NotNull Collection items,
-                                                                                       @NotNull final Convertor converter) {
+  public static @NotNull  MultiMap, T> splitIntoRepositoriesMap(final @NotNull SvnVcs vcs,
+                                                                                                @NotNull Collection items,
+                                                                                                final @NotNull Convertor converter) {
     return ContainerUtil.groupBy(items, item -> {
       RootUrlInfo path = vcs.getSvnFileUrlMapping().getWcRootForFilePath(converter.convert(item));
 
@@ -323,8 +316,7 @@ public final class SvnUtil {
    * Gets working copy internal format. Works for 1.7 and 1.8.
    *
    */
-  @NotNull
-  public static WorkingCopyFormat getFormat(final File path) {
+  public static @NotNull WorkingCopyFormat getFormat(final File path) {
     WorkingCopyFormat result = null;
     File dbFile = resolveDatabase(path);
 
@@ -360,14 +352,12 @@ public final class SvnUtil {
     return result;
   }
 
-  @Nullable
-  public static String getRepositoryUUID(final SvnVcs vcs, final File file) {
+  public static @Nullable String getRepositoryUUID(final SvnVcs vcs, final File file) {
     final Info info = vcs.getInfo(file);
     return info != null ? info.getRepositoryId() : null;
   }
 
-  @Nullable
-  public static String getRepositoryUUID(final SvnVcs vcs, final Url url) {
+  public static @Nullable String getRepositoryUUID(final SvnVcs vcs, final Url url) {
     try {
       final Info info = vcs.getInfo(url, Revision.UNDEFINED);
 
@@ -378,14 +368,12 @@ public final class SvnUtil {
     }
   }
 
-  @Nullable
-  public static Url getRepositoryRoot(final SvnVcs vcs, final File file) {
+  public static @Nullable Url getRepositoryRoot(final SvnVcs vcs, final File file) {
     final Info info = vcs.getInfo(file);
     return info != null ? info.getRepositoryRootUrl() : null;
   }
 
-  @Nullable
-  public static Url getRepositoryRoot(final SvnVcs vcs, final String url) {
+  public static @Nullable Url getRepositoryRoot(final SvnVcs vcs, final String url) {
     try {
       return getRepositoryRoot(vcs, createUrl(url));
     }
@@ -394,8 +382,7 @@ public final class SvnUtil {
     }
   }
 
-  @Nullable
-  public static Url getRepositoryRoot(final SvnVcs vcs, final Url url) throws SvnBindException {
+  public static @Nullable Url getRepositoryRoot(final SvnVcs vcs, final Url url) throws SvnBindException {
     Info info = vcs.getInfo(url, Revision.HEAD);
 
     return (info == null) ? null : info.getRepositoryRootUrl();
@@ -410,8 +397,7 @@ public final class SvnUtil {
     return adminDir != null && adminDir.findChild(WC_DB_FILE_NAME) != null;
   }
 
-  @NotNull
-  public static File fileFromUrl(final File baseDir, final String baseUrl, final String fullUrl) {
+  public static @NotNull File fileFromUrl(final File baseDir, final String baseUrl, final String fullUrl) {
     assert fullUrl.startsWith(baseUrl);
 
     final String part = fullUrl.substring(baseUrl.length()).replace('/', File.separatorChar).replace('\\', File.separatorChar);
@@ -419,12 +405,11 @@ public final class SvnUtil {
   }
 
   public static VirtualFile getVirtualFile(final String filePath) {
-    @NonNls final String path = VfsUtilCore.pathToUrl(filePath.replace(File.separatorChar, '/'));
+    final @NonNls String path = VfsUtilCore.pathToUrl(filePath.replace(File.separatorChar, '/'));
     return ReadAction.compute(() -> VirtualFileManager.getInstance().findFileByUrl(path));
   }
 
-  @Nullable
-  public static Url getBranchForUrl(@NotNull SvnVcs vcs, @NotNull VirtualFile vcsRoot, @NotNull Url url) {
+  public static @Nullable Url getBranchForUrl(@NotNull SvnVcs vcs, @NotNull VirtualFile vcsRoot, @NotNull Url url) {
     Url result = null;
     SvnBranchConfigurationNew configuration = SvnBranchConfigurationManager.getInstance(vcs.getProject()).get(vcsRoot);
 
@@ -455,8 +440,7 @@ public final class SvnUtil {
     return result;
   }
 
-  @Nullable
-  public static Status getStatus(@NotNull final SvnVcs vcs, @NotNull final File file) {
+  public static @Nullable Status getStatus(final @NotNull SvnVcs vcs, final @NotNull File file) {
     try {
       return vcs.getFactory(file).createStatusClient().doStatus(file, false);
     }
@@ -465,8 +449,7 @@ public final class SvnUtil {
     }
   }
 
-  @NotNull
-  public static Depth getDepth(final SvnVcs vcs, final File file) {
+  public static @NotNull Depth getDepth(final SvnVcs vcs, final File file) {
     Info info = vcs.getInfo(file);
 
     return info != null && info.getDepth() != null ? info.getDepth() : Depth.UNKNOWN;
@@ -503,8 +486,7 @@ public final class SvnUtil {
     return false;
   }
 
-  @Nullable
-  public static Url getUrl(final SvnVcs vcs, final File file) {
+  public static @Nullable Url getUrl(final SvnVcs vcs, final File file) {
     // todo for moved items?
     final Info info = vcs.getInfo(file);
 
@@ -528,8 +510,7 @@ public final class SvnUtil {
     return new File(file, SVN_ADMIN_DIR_NAME + "/wc.db");
   }
 
-  @Nullable
-  public static File getWorkingCopyRoot(@NotNull File file) {
+  public static @Nullable File getWorkingCopyRoot(@NotNull File file) {
     File current = getParentWithDb(file);
     if (current == null) return null;
 
@@ -538,8 +519,7 @@ public final class SvnUtil {
     return format.isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN) ? current : null;
   }
 
-  @Nullable
-  public static VirtualFile getWorkingCopyRoot(@NotNull VirtualFile file) {
+  public static @Nullable VirtualFile getWorkingCopyRoot(@NotNull VirtualFile file) {
     do {
       if (isWorkingCopyRoot(file)) return file;
       file = file.getParent();
@@ -549,8 +529,7 @@ public final class SvnUtil {
     return null;
   }
 
-  @Nullable
-  public static File getParentWithDb(@NotNull File file) {
+  public static @Nullable File getParentWithDb(@NotNull File file) {
     File current = file;
     boolean wcDbFound = false;
     while (current != null) {
@@ -585,25 +564,21 @@ public final class SvnUtil {
     return  FileUtilRt.getRelativePath(FileUtil.toSystemIndependentName(parentPath), FileUtil.toSystemIndependentName(childPath), '/');
   }
 
-  @NotNull
   @Contract(pure = true)
-  public static String ensureStartSlash(@NotNull String path) {
+  public static @NotNull String ensureStartSlash(@NotNull String path) {
     return StringUtil.startsWithChar(path, '/') ? path : '/' + path;
   }
 
-  @NotNull
-  public static String join(final String @NotNull ... parts) {
+  public static @NotNull String join(final String @NotNull ... parts) {
     return StringUtil.join(parts, "/");
   }
 
-  @NotNull
-  public static Url removePathTail(@NotNull Url url) throws SvnBindException {
+  public static @NotNull Url removePathTail(@NotNull Url url) throws SvnBindException {
     // TODO: Fix - remove tail only from path
     return createUrl(Url.removeTail(url.toDecodedString()), false);
   }
 
-  @NotNull
-  public static Revision getHeadRevision(@NotNull SvnVcs vcs, @NotNull Url url) throws SvnBindException {
+  public static @NotNull Revision getHeadRevision(@NotNull SvnVcs vcs, @NotNull Url url) throws SvnBindException {
     Info info = vcs.getInfo(url, Revision.HEAD);
 
     if (info == null) {
@@ -616,26 +591,23 @@ public final class SvnUtil {
     return info.getRevision();
   }
 
-  public static byte[] getFileContents(@NotNull final SvnVcs vcs,
-                                       @NotNull final Target target,
-                                       @Nullable final Revision revision,
-                                       @Nullable final Revision pegRevision)
+  public static byte[] getFileContents(final @NotNull SvnVcs vcs,
+                                       final @NotNull Target target,
+                                       final @Nullable Revision revision,
+                                       final @Nullable Revision pegRevision)
     throws VcsException {
     return vcs.getFactory(target).createContentClient().getContent(target, revision, pegRevision);
   }
 
-  @NotNull
-  public static Url createUrl(@NotNull String url) throws SvnBindException {
+  public static @NotNull Url createUrl(@NotNull String url) throws SvnBindException {
     return createUrl(url, true);
   }
 
-  @NotNull
-  public static Url createUrl(@NotNull String url, boolean encoded) throws SvnBindException {
+  public static @NotNull Url createUrl(@NotNull String url, boolean encoded) throws SvnBindException {
     return Url.parse(url, encoded);
   }
 
-  @NotNull
-  public static Url parseUrl(@NotNull String url) {
+  public static @NotNull Url parseUrl(@NotNull String url) {
     try {
       return createUrl(url);
     }
@@ -644,8 +616,7 @@ public final class SvnUtil {
     }
   }
 
-  @NotNull
-  public static Url parseUrl(@NotNull String url, boolean encoded) {
+  public static @NotNull Url parseUrl(@NotNull String url, boolean encoded) {
     try {
       return createUrl(url, encoded);
     }
@@ -654,23 +625,19 @@ public final class SvnUtil {
     }
   }
 
-  @NotNull
-  public static Url append(@NotNull Url parent, @NotNull String child) throws SvnBindException {
+  public static @NotNull Url append(@NotNull Url parent, @NotNull String child) throws SvnBindException {
     return append(parent, child, false);
   }
 
-  @NotNull
-  public static Url append(@NotNull Url parent, @NotNull String child, boolean encoded) throws SvnBindException {
+  public static @NotNull Url append(@NotNull Url parent, @NotNull String child, boolean encoded) throws SvnBindException {
     return parent.appendPath(child, encoded);
   }
 
-  @NotNull
-  public static IllegalArgumentException createIllegalArgument(@NotNull Exception e) {
+  public static @NotNull IllegalArgumentException createIllegalArgument(@NotNull Exception e) {
     return new IllegalArgumentException(e);
   }
 
-  @Nullable
-  public static String getChangelistName(@NotNull final Status status) {
+  public static @Nullable String getChangelistName(final @NotNull Status status) {
     // no explicit check on working copy format supports change lists as they are supported from svn 1.5
     // and anyway status.getChangeListName() should just return null if change lists are not supported.
     return status.getNodeKind().isFile() ? status.getChangeListName() : null;
@@ -694,13 +661,11 @@ public final class SvnUtil {
   }
 
   // TODO: Create custom Target class and implement append there
-  @NotNull
-  public static Target append(@NotNull Target target, @NotNull String path) throws SvnBindException {
+  public static @NotNull Target append(@NotNull Target target, @NotNull String path) throws SvnBindException {
     return append(target, path, false);
   }
 
-  @NotNull
-  public static Target append(@NotNull Target target, @NotNull String path, boolean checkAbsolute) throws SvnBindException {
+  public static @NotNull Target append(@NotNull Target target, @NotNull String path, boolean checkAbsolute) throws SvnBindException {
     Target result;
 
     if (target.isFile()) {
@@ -713,8 +678,7 @@ public final class SvnUtil {
     return result;
   }
 
-  @NotNull
-  public static File resolvePath(@NotNull File base, @NotNull String path) {
+  public static @NotNull File resolvePath(@NotNull File base, @NotNull String path) {
     File result = new File(path);
 
     if (!result.isAbsolute()) {
@@ -730,8 +694,7 @@ public final class SvnUtil {
    * 

* Current utility method fixes this case. */ - @NotNull - public static String toDecodedString(@NotNull Target target) { + public static @NotNull String toDecodedString(@NotNull Target target) { return target.isFile() ? target.getFile().getPath() : target.getUrl().toDecodedString(); } @@ -741,7 +704,7 @@ public final class SvnUtil { private static final String SQLITE_JDBC_TEMP_DIR_PROPERTY = "org.sqlite.tmpdir"; private static final @NonNls String USER_VERSION_QUERY = "pragma user_version"; - @NotNull private final File myDbFile; + private final @NotNull File myDbFile; static { ensureTempFolder(); @@ -751,9 +714,8 @@ public final class SvnUtil { myDbFile = dbFile; } - @Nullable @Override - public WorkingCopyFormat execute(boolean lastAttempt) { + public @Nullable WorkingCopyFormat execute(boolean lastAttempt) { Connection connection = null; int userVersion = 0; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java index f2cbc741727c..86d1be6c2d88 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java @@ -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 org.jetbrains.idea.svn; import com.intellij.application.Topics; @@ -118,7 +118,7 @@ public final class SvnVcs extends AbstractVcs { private SvnBranchPointsCalculator mySvnBranchPointsCalculator; private SvnCheckoutProvider myCheckoutProvider; - @NotNull private final ClientFactory cmdClientFactory; + private final @NotNull ClientFactory cmdClientFactory; private final boolean myLogExceptions; @@ -284,8 +284,7 @@ public final class SvnVcs extends AbstractVcs { } @Override - @NotNull - public ChangeProvider getChangeProvider() { + public @NotNull ChangeProvider getChangeProvider() { if (myChangeProvider == null) { myChangeProvider = new SvnChangeProvider(this); } @@ -308,27 +307,22 @@ public final class SvnVcs extends AbstractVcs { return mySvnUpdateEnvironment; } - @NotNull @Override - public String getDisplayName() { + public @NotNull String getDisplayName() { return VCS_DISPLAY_NAME; } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return VCS_SHORT_DISPLAY_NAME; } - @Nls - @NotNull @Override - public String getShortNameWithMnemonic() { + public @Nls @NotNull String getShortNameWithMnemonic() { return SvnBundle.message("svn.short.name.with.mnemonic"); } - @NotNull - public SvnConfiguration getSvnConfiguration() { + public @NotNull SvnConfiguration getSvnConfiguration() { return SvnConfiguration.getInstance(myProject); } @@ -337,8 +331,7 @@ public final class SvnVcs extends AbstractVcs { } @Override - @NotNull - public CheckinEnvironment createCheckinEnvironment() { + public @NotNull CheckinEnvironment createCheckinEnvironment() { if (myCheckinEnvironment == null) { myCheckinEnvironment = new SvnCheckinEnvironment(this); } @@ -346,8 +339,7 @@ public final class SvnVcs extends AbstractVcs { } @Override - @NotNull - public RollbackEnvironment createRollbackEnvironment() { + public @NotNull RollbackEnvironment createRollbackEnvironment() { if (myRollbackEnvironment == null) { myRollbackEnvironment = new SvnRollbackEnvironment(this); } @@ -355,8 +347,7 @@ public final class SvnVcs extends AbstractVcs { } @Override - @NotNull - public SvnHistoryProvider getVcsHistoryProvider() { + public @NotNull SvnHistoryProvider getVcsHistoryProvider() { // no heavy state, but it would be useful to have place to keep state in -> do not reuse instance return new SvnHistoryProvider(this); } @@ -392,8 +383,7 @@ public final class SvnVcs extends AbstractVcs { vcsManager.getStandardOption(VcsConfiguration.StandardOption.CHECKOUT, this); } - @Nullable - public PropertyValue getPropertyWithCaching(@NotNull VirtualFile file, @NotNull String propName) throws VcsException { + public @Nullable PropertyValue getPropertyWithCaching(@NotNull VirtualFile file, @NotNull String propName) throws VcsException { // TODO Method is called in EDT - fix File ioFile = virtualToIoFile(file); PropertyClient client = getFactory(ioFile).createPropertyClient(); @@ -424,28 +414,23 @@ public final class SvnVcs extends AbstractVcs { return file != null && SvnStatusUtil.isUnderControl(this, file); } - @Nullable - public Info getInfo(@NotNull Url url, Revision pegRevision, Revision revision) throws SvnBindException { + public @Nullable Info getInfo(@NotNull Url url, Revision pegRevision, Revision revision) throws SvnBindException { return getFactory().createInfoClient().doInfo(Target.on(url, pegRevision), revision); } - @Nullable - public Info getInfo(@NotNull Url url, Revision revision) throws SvnBindException { + public @Nullable Info getInfo(@NotNull Url url, Revision revision) throws SvnBindException { return getInfo(url, Revision.UNDEFINED, revision); } - @Nullable - public Info getInfo(@NotNull final VirtualFile file) { + public @Nullable Info getInfo(final @NotNull VirtualFile file) { return getInfo(virtualToIoFile(file)); } - @Nullable - public Info getInfo(@NotNull String path) { + public @Nullable Info getInfo(@NotNull String path) { return getInfo(new File(path)); } - @Nullable - public Info getInfo(@NotNull File ioFile) { + public @Nullable Info getInfo(@NotNull File ioFile) { return getInfo(ioFile, Revision.UNDEFINED); } @@ -462,8 +447,7 @@ public final class SvnVcs extends AbstractVcs { } } - @Nullable - public Info getInfo(@NotNull File ioFile, @NotNull Revision revision) { + public @Nullable Info getInfo(@NotNull File ioFile, @NotNull Revision revision) { Info result = null; try { @@ -489,13 +473,11 @@ public final class SvnVcs extends AbstractVcs { } } - @NotNull - public WorkingCopyFormat getWorkingCopyFormat(@NotNull File ioFile) { + public @NotNull WorkingCopyFormat getWorkingCopyFormat(@NotNull File ioFile) { return getWorkingCopyFormat(ioFile, true); } - @NotNull - public WorkingCopyFormat getWorkingCopyFormat(@NotNull File ioFile, boolean useMapping) { + public @NotNull WorkingCopyFormat getWorkingCopyFormat(@NotNull File ioFile, boolean useMapping) { WorkingCopyFormat format = WorkingCopyFormat.UNKNOWN; if (useMapping) { @@ -525,17 +507,15 @@ public final class SvnVcs extends AbstractVcs { @Override - @NotNull - public CommittedChangesProvider getCommittedChangesProvider() { + public @NotNull CommittedChangesProvider getCommittedChangesProvider() { if (myCommittedChangesProvider == null) { myCommittedChangesProvider = new SvnCommittedChangesProvider(this); } return myCommittedChangesProvider; } - @Nullable @Override - public VcsRevisionNumber parseRevisionNumber(final String revisionNumberString) { + public @Nullable VcsRevisionNumber parseRevisionNumber(final String revisionNumberString) { final Revision revision = Revision.parse(revisionNumberString); if (revision.equals(Revision.UNDEFINED)) { return null; @@ -553,8 +533,7 @@ public final class SvnVcs extends AbstractVcs { return SvnUtil.seemsLikeVersionedDir(dir); } - @NotNull - public SvnFileUrlMapping getSvnFileUrlMapping() { + public @NotNull SvnFileUrlMapping getSvnFileUrlMapping() { return myProject.getService(SvnFileUrlMapping.class); } @@ -614,16 +593,14 @@ public final class SvnVcs extends AbstractVcs { return true; } - @NotNull @Override - public List filterUniqueRoots(@NotNull List in, @NotNull Function convertor) { + public @NotNull List filterUniqueRoots(@NotNull List in, @NotNull Function convertor) { if (in.size() <= 1) return in; return Registry.is("svn.filter.unique.roots.by.url") ? filterUniqueByUrl(in, convertor) : filterUniqueByWorkingCopy(in, convertor); } - @NotNull - private List filterUniqueByUrl(@NotNull List in, @NotNull Function convertor) { + private @NotNull List filterUniqueByUrl(@NotNull List in, @NotNull Function convertor) { List> infos = new ArrayList<>(); List notMatched = new ArrayList<>(); for (S s : in) { @@ -648,9 +625,8 @@ public final class SvnVcs extends AbstractVcs { return concat(converted, notMatched); } - @NotNull - private List filterUniqueByWorkingCopy(@NotNull List in, - @NotNull Function convertor) { + private @NotNull List filterUniqueByWorkingCopy(@NotNull List in, + @NotNull Function convertor) { Map filesMap = StreamEx.of(in).mapToEntry(convertor, identity()).distinctKeys().toMap(); Map> byWorkingCopy = StreamEx.of(filesMap.keySet()) @@ -674,8 +650,8 @@ public final class SvnVcs extends AbstractVcs { } private static final class MyPair implements RootUrlPair { - @NotNull private final VirtualFile myFile; - @NotNull private final Url myUrl; + private final @NotNull VirtualFile myFile; + private final @NotNull Url myUrl; private final T mySrc; private MyPair(@NotNull VirtualFile file, @NotNull Url url, T src) { @@ -688,15 +664,13 @@ public final class SvnVcs extends AbstractVcs { return mySrc; } - @NotNull @Override - public VirtualFile getVirtualFile() { + public @NotNull VirtualFile getVirtualFile() { return myFile; } - @NotNull @Override - public Url getUrl() { + public @NotNull Url getUrl() { return myUrl; } } @@ -758,46 +732,38 @@ public final class SvnVcs extends AbstractVcs { * For instance, when working copies of several formats are presented in project * (though it seems to be rather unlikely case). */ - @NotNull - public ClientFactory getFactory() { + public @NotNull ClientFactory getFactory() { return cmdClientFactory; } @SuppressWarnings("unused") - @NotNull - public ClientFactory getFactory(@NotNull WorkingCopyFormat format) { + public @NotNull ClientFactory getFactory(@NotNull WorkingCopyFormat format) { return cmdClientFactory; } @SuppressWarnings("unused") - @NotNull - public ClientFactory getFactory(@NotNull File file) { + public @NotNull ClientFactory getFactory(@NotNull File file) { return cmdClientFactory; } @SuppressWarnings("unused") - @NotNull - public ClientFactory getFactory(@NotNull File file, boolean useMapping) { + public @NotNull ClientFactory getFactory(@NotNull File file, boolean useMapping) { return cmdClientFactory; } - @NotNull - public ClientFactory getFactory(@NotNull Target target) { + public @NotNull ClientFactory getFactory(@NotNull Target target) { return target.isFile() ? getFactory(target.getFile()) : getFactory(); } - @NotNull - public ClientFactory getFactoryFromSettings() { + public @NotNull ClientFactory getFactoryFromSettings() { return cmdClientFactory; } - @NotNull - public ClientFactory getCommandLineFactory() { + public @NotNull ClientFactory getCommandLineFactory() { return cmdClientFactory; } - @NotNull - public WorkingCopyFormat getLowestSupportedFormatForCommandLine() { + public @NotNull WorkingCopyFormat getLowestSupportedFormatForCommandLine() { WorkingCopyFormat result; try { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java index 25e5b3d309e2..ac3ce3fcdb43 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/UniqueRootsFilter.java @@ -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 org.jetbrains.idea.svn; import org.jetbrains.annotations.NotNull; @@ -13,8 +13,7 @@ import static org.jetbrains.idea.svn.SvnUtil.getRelativeUrl; public class UniqueRootsFilter { - @NotNull - public List filter(@NotNull List list) { + public @NotNull List filter(@NotNull List list) { List result = new ArrayList<>(); list.sort(comparing(item -> item.getVirtualFile().getPath())); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java index 173580a59a6d..a846a67c8cae 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopiesContent.java @@ -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 org.jetbrains.idea.svn; import com.intellij.openapi.project.Project; @@ -17,7 +17,7 @@ import java.util.function.Predicate; import java.util.function.Supplier; public final class WorkingCopiesContent implements ChangesViewContentProvider { - @NotNull private final Project myProject; + private final @NotNull Project myProject; public WorkingCopiesContent(@NotNull Project project) { myProject = project; @@ -41,22 +41,21 @@ public final class WorkingCopiesContent implements ChangesViewContentProvider { } } - final static class VisibilityPredicate implements Predicate { + static final class VisibilityPredicate implements Predicate { @Override public boolean test(@NotNull Project project) { return ProjectLevelVcsManager.getInstance(project).checkVcsIsActive(SvnVcs.VCS_NAME); } } - final static class DisplayNameSupplier implements Supplier { + static final class DisplayNameSupplier implements Supplier { @Override public String get() { return SvnBundle.message("toolwindow.working.copies.info.title"); } } - @NotNull - public static String getTabName() { + public static @NotNull String getTabName() { return SvnBundle.message("dialog.show.svn.map.title"); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopyFormat.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopyFormat.java index c9dcc9742799..6d8b97c217ab 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopyFormat.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/WorkingCopyFormat.java @@ -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 org.jetbrains.idea.svn; import com.intellij.openapi.util.NlsSafe; @@ -24,7 +24,7 @@ public enum WorkingCopyFormat { private static final Version ONE_DOT_NINE_VERSION = new Version(1, 9, 0); private final int myFormat; - @NotNull private final Version myVersion; + private final @NotNull Version myVersion; WorkingCopyFormat(int format, @NotNull Version version) { myFormat = format; @@ -47,13 +47,11 @@ public enum WorkingCopyFormat { return this == UNKNOWN ? message("label.working.copy.format.unknown") : getName(); } - @NotNull - public Version getVersion() { + public @NotNull Version getVersion() { return myVersion; } - @NotNull - public static WorkingCopyFormat getInstance(int value) { + public static @NotNull WorkingCopyFormat getInstance(int value) { if (INTERNAL_FORMAT_17 == value) { return ONE_DOT_SEVEN; } else if (INTERNAL_FORMAT_18 == value) { @@ -84,8 +82,7 @@ public enum WorkingCopyFormat { return myVersion.lessThan(format.getVersion().major, format.getVersion().minor); } - @NotNull - public static WorkingCopyFormat from(@NotNull Version version) { + public static @NotNull WorkingCopyFormat from(@NotNull Version version) { return version.compareTo(ONE_DOT_NINE_VERSION) >= 0 ? ONE_DOT_EIGHT : Stream.of(values()) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractIntegrateChangesAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractIntegrateChangesAction.java index 9cedf0ffaeae..a3dad50a4398 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractIntegrateChangesAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/AbstractIntegrateChangesAction.java @@ -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 org.jetbrains.idea.svn.actions; import com.intellij.openapi.actionSystem.*; @@ -26,10 +26,8 @@ public abstract class AbstractIntegrateChangesAction fileStream = Stream.of(files); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupAction.java index bd7e3c4d7752..0bf07ebcbb4b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupAction.java @@ -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 org.jetbrains.idea.svn.actions; @@ -14,9 +14,8 @@ import org.jetbrains.idea.svn.SvnVcs; import static java.util.Collections.singletonList; public class CleanupAction extends BasicAction { - @NotNull @Override - protected String getActionName() { + protected @NotNull String getActionName() { return SvnBundle.message("cleanup.action.name"); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java index 1a6ce2e8d1ca..f97fda89bcdf 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CleanupWorker.java @@ -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 org.jetbrains.idea.svn.actions; import com.intellij.configurationStore.StoreUtil; @@ -29,9 +29,9 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class CleanupWorker extends Task.Backgroundable { - @NotNull protected final List myRoots; - @NotNull private final SvnVcs myVcs; - @NotNull private final List> myExceptions = new ArrayList<>(); + protected final @NotNull List myRoots; + private final @NotNull SvnVcs myVcs; + private final @NotNull List> myExceptions = new ArrayList<>(); public CleanupWorker(@NotNull SvnVcs vcs, @NotNull List roots) { this(vcs, roots, null); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IgnoreActionGroup.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IgnoreActionGroup.java index 150a2ee72d1e..febd9beb919b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IgnoreActionGroup.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IgnoreActionGroup.java @@ -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 org.jetbrains.idea.svn.actions; import com.intellij.openapi.actionSystem.*; @@ -28,7 +28,7 @@ public class IgnoreActionGroup extends DefaultActionGroup implements DumbAware { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); IgnoreGroupHelperAction helper = IgnoreGroupHelperAction.createFor(e); if (helper == null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IntegrateChangeSetAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IntegrateChangeSetAction.java index 92c99934275a..bc15eef485d2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IntegrateChangeSetAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/IntegrateChangeSetAction.java @@ -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 org.jetbrains.idea.svn.actions; import org.jetbrains.annotations.NotNull; @@ -15,20 +15,17 @@ public class IntegrateChangeSetAction extends AbstractIntegrateChangesAction Target.on(parentUrl, Revision.HEAD); case useProjectName -> createRemoteFolder(vcs, parentUrl, file.getName(), commitText); @@ -158,11 +156,10 @@ public class ShareProjectAction extends BasicAction { () -> SvnUtil.remoteFolderIsEmpty(vcs, folderUrl), message("progress.title.check.remote.folder.contents"), false, vcs.getProject()); } - @NotNull - private static Target createRemoteFolder(@NotNull SvnVcs vcs, - @NotNull Url parent, - @NotNull String folderName, - @NotNull String commitText) throws VcsException { + private static @NotNull Target createRemoteFolder(@NotNull SvnVcs vcs, + @NotNull Url parent, + @NotNull String folderName, + @NotNull String commitText) throws VcsException { Url url = append(parent, folderName); String message = message("share.directory.commit.message", folderName, ApplicationNamesInfo.getInstance().getFullProductName(), commitText); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareWholeProject.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareWholeProject.java index a55cb89652a5..0fabf80ce264 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareWholeProject.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/ShareWholeProject.java @@ -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 org.jetbrains.idea.svn.actions; import com.intellij.openapi.actionSystem.*; @@ -30,7 +30,7 @@ public class ShareWholeProject extends AnAction implements DumbAware { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { final MyChecker checker = new MyChecker(); checker.execute(e); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java index e3fec8f9060d..1c59ade2711c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnMergeProvider.java @@ -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 org.jetbrains.idea.svn.actions; import com.intellij.openapi.diagnostic.Logger; @@ -42,8 +42,7 @@ public class SvnMergeProvider implements MergeProvider { } @Override - @NotNull - public MergeData loadRevisions(@NotNull final VirtualFile file) throws VcsException { + public @NotNull MergeData loadRevisions(final @NotNull VirtualFile file) throws VcsException { final MergeData data = new MergeData(); SvnVcs vcs = SvnVcs.getInstance(myProject); Info info = vcs.getInfo(file); @@ -131,7 +130,7 @@ public class SvnMergeProvider implements MergeProvider { } @Override - public boolean isBinary(@NotNull final VirtualFile file) { + public boolean isBinary(final @NotNull VirtualFile file) { SvnVcs vcs = SvnVcs.getInstance(myProject); try { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnQuickListContentProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnQuickListContentProvider.java index 220f57225ff8..3dbbdcb7c010 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnQuickListContentProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/SvnQuickListContentProvider.java @@ -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 org.jetbrains.idea.svn.actions; import com.intellij.openapi.actionSystem.ActionManager; @@ -14,9 +14,8 @@ import java.util.List; * @author Roman.Chernyatchik */ public class SvnQuickListContentProvider extends VcsQuickListContentProviderBase { - @NotNull @Override - protected String getVcsName() { + protected @NotNull String getVcsName() { return SvnVcs.VCS_NAME; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/UnlockAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/UnlockAction.java index 6c03b5d2f7fc..5a40f6672fab 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/UnlockAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/UnlockAction.java @@ -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 org.jetbrains.idea.svn.actions; @@ -16,9 +16,8 @@ import static com.intellij.util.containers.ContainerUtil.ar; import static org.jetbrains.idea.svn.SvnUtil.toIoFiles; public class UnlockAction extends BasicAction { - @NotNull @Override - protected String getActionName() { + protected @NotNull String getActionName() { return SvnBundle.message("action.Subversion.Unlock.description"); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java index 7b431398fc0c..00ac363c44ce 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/BaseSvnFileAnnotation.java @@ -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 org.jetbrains.idea.svn.annotate; import com.intellij.openapi.util.NlsContexts; @@ -126,15 +126,13 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation { return new LineAnnotationAspect[]{REVISION_ASPECT, DATE_ASPECT, AUTHOR_ASPECT}; } - @Nullable @Override - public String getToolTip(int lineNumber) { + public @Nullable String getToolTip(int lineNumber) { return getToolTip(lineNumber, false); } - @Nullable @Override - public String getHtmlToolTip(int lineNumber) { + public @Nullable String getHtmlToolTip(int lineNumber) { return getToolTip(lineNumber, true); } @@ -161,8 +159,7 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation { } @Override - @Nullable - public VcsRevisionNumber originalRevision(final int lineNumber) { + public @Nullable VcsRevisionNumber originalRevision(final int lineNumber) { SvnFileRevision revision = myInfos.isValid(lineNumber) ? myRevisionMap.get(myInfos.originalRevision(lineNumber)) : null; return revision != null ? revision.getRevisionNumber() : null; @@ -190,13 +187,11 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation { } @Override - @Nullable - public AnnotationSourceSwitcher getAnnotationSourceSwitcher() { + public @Nullable AnnotationSourceSwitcher getAnnotationSourceSwitcher() { if (!myShowMergeSources) return null; return new AnnotationSourceSwitcher() { @Override - @NotNull - public AnnotationSource getAnnotationSource(int lineNumber) { + public @NotNull AnnotationSource getAnnotationSource(int lineNumber) { return myInfos.getAnnotationSource(lineNumber); } @@ -206,14 +201,12 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation { } @Override - @NotNull - public LineAnnotationAspect getRevisionAspect() { + public @NotNull LineAnnotationAspect getRevisionAspect() { return ORIGINAL_REVISION_ASPECT; } @Override - @NotNull - public AnnotationSource getDefaultSource() { + public @NotNull AnnotationSource getDefaultSource() { return AnnotationSource.getInstance(myShowMergeSources); } @@ -331,15 +324,13 @@ public abstract class BaseSvnFileAnnotation extends FileAnnotation { } } - @Nullable @Override - public VcsRevisionNumber getCurrentRevision() { + public @Nullable VcsRevisionNumber getCurrentRevision() { return myBaseRevision; } - @Nullable @Override - public LineModificationDetailsProvider getLineModificationDetailsProvider() { + public @Nullable LineModificationDetailsProvider getLineModificationDetailsProvider() { return DefaultLineModificationDetailsProvider.create(this); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java index 9184dc567c73..e4167540f647 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/CmdAnnotateClient.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.annotate; import com.intellij.openapi.vcs.VcsException; @@ -42,7 +28,7 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient { @NotNull Revision endRevision, boolean includeMergedRevisions, @Nullable DiffOptions diffOptions, - @Nullable final AnnotationConsumer handler) throws VcsException { + final @Nullable AnnotationConsumer handler) throws VcsException { List parameters = new ArrayList<>(); CommandUtil.put(parameters, target); CommandUtil.put(parameters, startRevision, endRevision); @@ -100,8 +86,7 @@ public class CmdAnnotateClient extends BaseSvnClient implements AnnotateClient { @XmlElement(name = "merged") public MergedEntry merged; - @Nullable - public CommitInfo mergedCommit() { + public @Nullable CommitInfo mergedCommit() { return merged != null && merged.commit != null ? merged.commit.build() : null; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java index 0381dd7692bc..ef8ac6698ea4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnAnnotationProvider.java @@ -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 org.jetbrains.idea.svn.annotate; import com.intellij.openapi.application.ApplicationManager; @@ -48,15 +48,14 @@ import static org.jetbrains.idea.svn.SvnUtil.*; public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAnnotationProvider { private static final Object MERGED_KEY = new Object(); - @NotNull private final SvnVcs myVcs; + private final @NotNull SvnVcs myVcs; public SvnAnnotationProvider(@NotNull SvnVcs vcs) { myVcs = vcs; } @Override - @NotNull - public FileAnnotation annotate(@NotNull VirtualFile file) throws VcsException { + public @NotNull FileAnnotation annotate(@NotNull VirtualFile file) throws VcsException { SvnDiffProvider provider = (SvnDiffProvider)myVcs.getDiffProvider(); SvnRevisionNumber currentRevision = ((SvnRevisionNumber)provider.getCurrentRevision(file)); VcsRevisionDescription lastChangedRevision = provider.getCurrentRevisionDescription(file); @@ -74,19 +73,17 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn } @Override - @NotNull - public FileAnnotation annotate(@NotNull VirtualFile file, @NotNull VcsFileRevision revision) throws VcsException { + public @NotNull FileAnnotation annotate(@NotNull VirtualFile file, @NotNull VcsFileRevision revision) throws VcsException { return annotate(file, ((SvnFileRevision)revision).getRevisionNumber(), revision.getRevisionNumber(), () -> { byte[] bytes = VcsHistoryUtil.loadRevisionContent(revision); return getTextByBinaryPresentation(bytes, file, false, false).toString(); }); } - @NotNull - private FileAnnotation annotate(@NotNull VirtualFile file, - @NotNull SvnRevisionNumber revisionNumber, - @NotNull VcsRevisionNumber lastChangedRevision, - @NotNull Throwable2Computable contentLoader) throws VcsException { + private @NotNull FileAnnotation annotate(@NotNull VirtualFile file, + @NotNull SvnRevisionNumber revisionNumber, + @NotNull VcsRevisionNumber lastChangedRevision, + @NotNull Throwable2Computable contentLoader) throws VcsException { if (file.isDirectory()) { throw new VcsException(message("exception.text.cannot.annotate.directory")); } @@ -218,12 +215,11 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn } } - @NotNull - private SvnRemoteFileAnnotation annotateNonExisting(@NotNull Pair pair, - @NotNull SvnRevisionNumber revisionNumber, - @NotNull Info info, - @NotNull Charset charset, - @NotNull VirtualFile current) throws VcsException, IOException { + private @NotNull SvnRemoteFileAnnotation annotateNonExisting(@NotNull Pair pair, + @NotNull SvnRevisionNumber revisionNumber, + @NotNull Info info, + @NotNull Charset charset, + @NotNull VirtualFile current) throws VcsException, IOException { final File wasFile = pair.getSecond().getIOFile(); final File root = getCommonAncestor(wasFile, info.getFile()); @@ -263,9 +259,8 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn return result; } - @NotNull - private static AnnotationConsumer createAnnotationHandler(@Nullable final ProgressIndicator progress, - @NotNull final BaseSvnFileAnnotation result) { + private static @NotNull AnnotationConsumer createAnnotationHandler(final @Nullable ProgressIndicator progress, + final @NotNull BaseSvnFileAnnotation result) { return (lineNumber, info, mergeInfo) -> { if (progress != null) { progress.checkCanceled(); @@ -315,13 +310,12 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn return vcsAnnotation; } - @Nullable @Override - public FileAnnotation restore(@NotNull VcsAnnotation vcsAnnotation, - @NotNull VcsAbstractHistorySession session, - @NotNull String annotatedContent, - boolean forCurrentRevision, - VcsRevisionNumber revisionNumber) { + public @Nullable FileAnnotation restore(@NotNull VcsAnnotation vcsAnnotation, + @NotNull VcsAbstractHistorySession session, + @NotNull String annotatedContent, + boolean forCurrentRevision, + VcsRevisionNumber revisionNumber) { final SvnFileAnnotation annotation = new SvnFileAnnotation(myVcs, vcsAnnotation.getFilePath().getVirtualFile(), annotatedContent, revisionNumber); final VcsLineAnnotationData basicAnnotation = vcsAnnotation.getBasicAnnotation(); @@ -448,8 +442,7 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn } } - @Nullable - private static DiffOptions getLogClientOptions(@NotNull SvnVcs vcs) { + private static @Nullable DiffOptions getLogClientOptions(@NotNull SvnVcs vcs) { return vcs.getSvnConfiguration().isIgnoreSpacesInAnnotate() ? new DiffOptions(true, true, true) : null; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseRepositoryProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseRepositoryProvider.java index 00fa0c3a7b08..51e9b7252029 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseRepositoryProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseRepositoryProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; @@ -20,8 +6,8 @@ import org.jetbrains.idea.svn.SvnVcs; public abstract class BaseRepositoryProvider implements RepositoryProvider { - @NotNull protected final SvnVcs myVcs; - @NotNull protected final Target myTarget; + protected final @NotNull SvnVcs myVcs; + protected final @NotNull Target myTarget; public BaseRepositoryProvider(@NotNull SvnVcs vcs, @NotNull Target target) { myVcs = vcs; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java index 47c1bd4eab51..81a98fcde9dc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/BaseSvnClient.java @@ -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 org.jetbrains.idea.svn.api; import com.intellij.openapi.vcs.VcsException; @@ -21,9 +21,8 @@ public abstract class BaseSvnClient implements SvnClient { protected ClientFactory myFactory; protected boolean myIsActive; - @NotNull @Override - public SvnVcs getVcs() { + public @NotNull SvnVcs getVcs() { return myVcs; } @@ -32,9 +31,8 @@ public abstract class BaseSvnClient implements SvnClient { myVcs = vcs; } - @NotNull @Override - public ClientFactory getFactory() { + public @NotNull ClientFactory getFactory() { return myFactory; } @@ -74,22 +72,20 @@ public abstract class BaseSvnClient implements SvnClient { } } - @NotNull - public CommandExecutor execute(@NotNull SvnVcs vcs, - @NotNull Target target, - @NotNull SvnCommandName name, - @NotNull List parameters, - @Nullable LineCommandListener listener) throws SvnBindException { + public @NotNull CommandExecutor execute(@NotNull SvnVcs vcs, + @NotNull Target target, + @NotNull SvnCommandName name, + @NotNull List parameters, + @Nullable LineCommandListener listener) throws SvnBindException { return execute(vcs, target, null, name, parameters, listener); } - @NotNull - public CommandExecutor execute(@NotNull SvnVcs vcs, - @NotNull Target target, - @Nullable File workingDirectory, - @NotNull SvnCommandName name, - @NotNull List parameters, - @Nullable LineCommandListener listener) throws SvnBindException { + public @NotNull CommandExecutor execute(@NotNull SvnVcs vcs, + @NotNull Target target, + @Nullable File workingDirectory, + @NotNull SvnCommandName name, + @NotNull List parameters, + @Nullable LineCommandListener listener) throws SvnBindException { Command command = newCommand(name); command.put(parameters); @@ -97,12 +93,11 @@ public abstract class BaseSvnClient implements SvnClient { return execute(vcs, target, workingDirectory, command, listener); } - @NotNull - public CommandExecutor execute(@NotNull SvnVcs vcs, - @NotNull Target target, - @Nullable File workingDirectory, - @NotNull Command command, - @Nullable LineCommandListener listener) throws SvnBindException { + public @NotNull CommandExecutor execute(@NotNull SvnVcs vcs, + @NotNull Target target, + @Nullable File workingDirectory, + @NotNull Command command, + @Nullable LineCommandListener listener) throws SvnBindException { command.setTarget(target); command.setWorkingDirectory(workingDirectory); command.setResultBuilder(listener); @@ -110,13 +105,11 @@ public abstract class BaseSvnClient implements SvnClient { return newRuntime(vcs).runWithAuthenticationAttempt(command); } - @NotNull - public Command newCommand(@NotNull SvnCommandName name) { + public @NotNull Command newCommand(@NotNull SvnCommandName name) { return new Command(name); } - @NotNull - public CommandRuntime newRuntime(@NotNull SvnVcs vcs) { + public @NotNull CommandRuntime newRuntime(@NotNull SvnVcs vcs) { return new CommandRuntime(vcs, new AuthenticationService(vcs, myIsActive)); } @@ -126,13 +119,11 @@ public abstract class BaseSvnClient implements SvnClient { } } - @NotNull - protected static ProgressEvent createEvent(@NotNull File path, @Nullable EventAction action) { + protected static @NotNull ProgressEvent createEvent(@NotNull File path, @Nullable EventAction action) { return new ProgressEvent(path, 0, null, null, action, null, null); } - @NotNull - protected static Revision notNullize(@Nullable Revision revision) { + protected static @NotNull Revision notNullize(@Nullable Revision revision) { return revision != null ? revision : Revision.UNDEFINED; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java index 1fab5d6abb8d..6af69290fbe9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ClientFactory.java @@ -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 org.jetbrains.idea.svn.api; import com.intellij.util.ReflectionUtil; @@ -34,8 +34,7 @@ import java.util.Map; public abstract class ClientFactory { - @NotNull - protected SvnVcs myVcs; + protected @NotNull SvnVcs myVcs; protected AddClient addClient; protected AnnotateClient annotateClient; @@ -63,7 +62,7 @@ public abstract class ClientFactory { protected CheckinClient myCheckinClient; protected RepositoryFeaturesClient myRepositoryFeaturesClient; - @NotNull private final Map myClientImplementations = new HashMap<>(); + private final @NotNull Map myClientImplementations = new HashMap<>(); protected ClientFactory(@NotNull SvnVcs vcs) { myVcs = vcs; @@ -77,8 +76,7 @@ public abstract class ClientFactory { } @SuppressWarnings("unchecked") - @NotNull - protected Class get(@NotNull Class type) { + protected @NotNull Class get(@NotNull Class type) { Class implementation = myClientImplementations.get(type); if (implementation == null) { @@ -91,146 +89,118 @@ public abstract class ClientFactory { /** * TODO: Provide more robust way for the default settings here - probably some default Command instance could be used. */ - @NotNull - public T create(@NotNull Class type, boolean isActive) { + public @NotNull T create(@NotNull Class type, boolean isActive) { T client = prepare(ReflectionUtil.newInstance(get(type))); client.setIsActive(isActive); return client; } - @NotNull - public AddClient createAddClient() { + public @NotNull AddClient createAddClient() { return prepare(addClient); } - @NotNull - public AnnotateClient createAnnotateClient() { + public @NotNull AnnotateClient createAnnotateClient() { return prepare(annotateClient); } - @NotNull - public ContentClient createContentClient() { + public @NotNull ContentClient createContentClient() { return prepare(contentClient); } - @NotNull - public HistoryClient createHistoryClient() { + public @NotNull HistoryClient createHistoryClient() { return prepare(historyClient); } - @NotNull - public RevertClient createRevertClient() { + public @NotNull RevertClient createRevertClient() { return prepare(revertClient); } - @NotNull - public StatusClient createStatusClient() { + public @NotNull StatusClient createStatusClient() { return prepare(statusClient); } - @NotNull - public InfoClient createInfoClient() { + public @NotNull InfoClient createInfoClient() { return prepare(infoClient); } // TODO: Update this in same like other clients - move to corresponding package, rename clients // New instances should be always created by this method, as setXxx() methods are currently used in update logic - @NotNull - public abstract UpdateClient createUpdateClient(); + public abstract @NotNull UpdateClient createUpdateClient(); - @NotNull - public DeleteClient createDeleteClient() { + public @NotNull DeleteClient createDeleteClient() { return prepare(deleteClient); } - @NotNull - public CopyMoveClient createCopyMoveClient() { + public @NotNull CopyMoveClient createCopyMoveClient() { return prepare(copyMoveClient); } - @NotNull - public ConflictClient createConflictClient() { + public @NotNull ConflictClient createConflictClient() { return prepare(conflictClient); } - @NotNull - public PropertyClient createPropertyClient() { + public @NotNull PropertyClient createPropertyClient() { return prepare(propertyClient); } - @NotNull - public MergeClient createMergeClient() { + public @NotNull MergeClient createMergeClient() { return prepare(mergeClient); } - @NotNull - public ChangeListClient createChangeListClient() { + public @NotNull ChangeListClient createChangeListClient() { return prepare(changeListClient); } - @NotNull - public CheckoutClient createCheckoutClient() { + public @NotNull CheckoutClient createCheckoutClient() { return prepare(checkoutClient); } - @NotNull - public LockClient createLockClient() { + public @NotNull LockClient createLockClient() { return prepare(myLockClient); } - @NotNull - public CleanupClient createCleanupClient() { + public @NotNull CleanupClient createCleanupClient() { return prepare(myCleanupClient); } - @NotNull - public RelocateClient createRelocateClient() { + public @NotNull RelocateClient createRelocateClient() { return prepare(myRelocateClient); } - @NotNull - public VersionClient createVersionClient() { + public @NotNull VersionClient createVersionClient() { return prepare(myVersionClient); } - @NotNull - public ImportClient createImportClient() { + public @NotNull ImportClient createImportClient() { return prepare(myImportClient); } - @NotNull - public ExportClient createExportClient() { + public @NotNull ExportClient createExportClient() { return prepare(myExportClient); } - @NotNull - public UpgradeClient createUpgradeClient() { + public @NotNull UpgradeClient createUpgradeClient() { return prepare(myUpgradeClient); } - @NotNull - public BrowseClient createBrowseClient() { + public @NotNull BrowseClient createBrowseClient() { return prepare(myBrowseClient); } - @NotNull - public DiffClient createDiffClient() { + public @NotNull DiffClient createDiffClient() { return prepare(myDiffClient); } - @NotNull - public CheckinClient createCheckinClient() { + public @NotNull CheckinClient createCheckinClient() { return prepare(myCheckinClient); } - @NotNull - public RepositoryFeaturesClient createRepositoryFeaturesClient() { + public @NotNull RepositoryFeaturesClient createRepositoryFeaturesClient() { return prepare(myRepositoryFeaturesClient); } - @NotNull - protected T prepare(@NotNull T client) { + protected @NotNull T prepare(@NotNull T client) { client.setVcs(myVcs); client.setFactory(this); client.setIsActive(true); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdClientFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdClientFactory.java index 8475c3eac93b..02799dca616b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdClientFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdClientFactory.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; @@ -68,9 +69,8 @@ public class CmdClientFactory extends ClientFactory { put(InfoClient.class, CmdInfoClient.class); } - @NotNull @Override - public UpdateClient createUpdateClient() { + public @NotNull UpdateClient createUpdateClient() { return prepare(new CmdUpdateClient()); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java index c15cec4bd788..b6e51006d61f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/CmdVersionClient.java @@ -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 org.jetbrains.idea.svn.api; import com.intellij.execution.process.ProcessOutput; @@ -19,14 +19,12 @@ public class CmdVersionClient extends BaseSvnClient implements VersionClient { private static final Pattern VERSION = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)"); private static final int COMMAND_TIMEOUT = 30 * 1000; - @NotNull @Override - public Version getVersion() throws SvnBindException { + public @NotNull Version getVersion() throws SvnBindException { return parseVersion(runCommand(true)); } - @NotNull - public ProcessOutput runCommand(boolean quiet) throws SvnBindException { + public @NotNull ProcessOutput runCommand(boolean quiet) throws SvnBindException { Command command = new Command(SvnCommandName.version); if (quiet) { command.put("--quiet"); @@ -35,8 +33,7 @@ public class CmdVersionClient extends BaseSvnClient implements VersionClient { return newRuntime(myVcs).runLocal(command, COMMAND_TIMEOUT).getProcessOutput(); } - @NotNull - private static Version parseVersion(@NotNull ProcessOutput output) throws SvnBindException { + private static @NotNull Version parseVersion(@NotNull ProcessOutput output) throws SvnBindException { // TODO: This or similar check should likely go to CommandRuntime - to be applied for all commands if (output.isTimeout()) { throw new SvnBindException(message("error.could.not.get.svn.version", output.getExitCode(), output.getStderr())); @@ -45,8 +42,7 @@ public class CmdVersionClient extends BaseSvnClient implements VersionClient { return parseVersion(output.getStdout()); } - @NotNull - public static Version parseVersion(@NlsSafe @NotNull String versionText) throws SvnBindException { + public static @NotNull Version parseVersion(@NlsSafe @NotNull String versionText) throws SvnBindException { Version result = null; Exception cause = null; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java index adef5066e1f4..39a28af5edeb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Depth.java @@ -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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.Nls; @@ -21,7 +21,7 @@ public enum Depth { @XmlEnumValue("empty") EMPTY("empty"), @XmlEnumValue("exclude") EXCLUDE("exclude"); - @NotNull private static final Map ourAllDepths = new HashMap<>(); + private static final @NotNull Map ourAllDepths = new HashMap<>(); static { for (Depth action : values()) { @@ -59,8 +59,7 @@ public enum Depth { ourAllDepths.put(depth.myName, depth); } - @NotNull - public static Depth from(@NonNls @NotNull String depthName) { + public static @NotNull Depth from(@NonNls @NotNull String depthName) { Depth result = ourAllDepths.get(depthName); if (result == null) { @@ -70,13 +69,11 @@ public enum Depth { return result; } - @NotNull - public static Depth allOrFiles(boolean recursive) { + public static @NotNull Depth allOrFiles(boolean recursive) { return recursive ? INFINITY : FILES; } - @NotNull - public static Depth allOrEmpty(boolean recursive) { + public static @NotNull Depth allOrEmpty(boolean recursive) { return recursive ? INFINITY : EMPTY; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java index 03e31f7fa3f0..9f7d626b2461 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/FileStatusResultParser.java @@ -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 org.jetbrains.idea.svn.api; import com.intellij.openapi.util.text.StringUtil; @@ -14,14 +14,11 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class FileStatusResultParser { - @NotNull - private final Pattern myLinePattern; + private final @NotNull Pattern myLinePattern; - @Nullable - private final ProgressTracker handler; + private final @Nullable ProgressTracker handler; - @NotNull - private final Convertor myConvertor; + private final @NotNull Convertor myConvertor; public FileStatusResultParser(@NotNull Pattern linePattern, @Nullable ProgressTracker handler, diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java index b41b53821b8f..8ecdbfdb9af9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/InfoCommandRepositoryProvider.java @@ -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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; @@ -12,9 +12,8 @@ public class InfoCommandRepositoryProvider extends BaseRepositoryProvider { super(vcs, target); } - @Nullable @Override - public Repository get() { + public @Nullable Repository get() { Repository result; if (myTarget.isUrl()) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java index fa97d144de24..c5a1d8e93b06 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/NodeKind.java @@ -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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ public enum NodeKind { // used in ConflictVersion when node is missing @XmlEnumValue("none") NONE("none"); - @NotNull private static final Map ourAllNodeKinds = new HashMap<>(); + private static final @NotNull Map ourAllNodeKinds = new HashMap<>(); static { for (NodeKind kind : NodeKind.values()) { @@ -27,7 +27,7 @@ public enum NodeKind { ourAllNodeKinds.put("", UNKNOWN); } - @NotNull private final String myKey; + private final @NotNull String myKey; NodeKind(@NotNull String key) { myKey = key; @@ -54,8 +54,7 @@ public enum NodeKind { ourAllNodeKinds.put(kind.myKey, kind); } - @NotNull - public static NodeKind from(@NotNull String nodeKindName) { + public static @NotNull NodeKind from(@NotNull String nodeKindName) { NodeKind result = ourAllNodeKinds.get(nodeKindName); if (result == null) { @@ -65,8 +64,7 @@ public enum NodeKind { return result; } - @NotNull - public static NodeKind from(boolean isDirectory) { + public static @NotNull NodeKind from(boolean isDirectory) { return isDirectory ? DIR : FILE; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java index 2d3468a0f95a..afdad5a949dc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/ProgressEvent.java @@ -1,4 +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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; @@ -14,9 +14,9 @@ public class ProgressEvent { private final long myRevision; private final Url myURL; - @NotNull private final StatusType myContentsStatus; - @NotNull private final StatusType myPropertiesStatus; - @Nullable private final String myErrorMessage; + private final @NotNull StatusType myContentsStatus; + private final @NotNull StatusType myPropertiesStatus; + private final @Nullable String myErrorMessage; private final EventAction myAction; public ProgressEvent(@Nullable String errorMessage) { @@ -47,18 +47,15 @@ public class ProgressEvent { return myAction; } - @NotNull - public StatusType getContentsStatus() { + public @NotNull StatusType getContentsStatus() { return myContentsStatus; } - @Nullable - public String getErrorMessage() { + public @Nullable String getErrorMessage() { return myErrorMessage; } - @NotNull - public StatusType getPropertiesStatus() { + public @NotNull StatusType getPropertiesStatus() { return myPropertiesStatus; } @@ -70,8 +67,7 @@ public class ProgressEvent { return myURL; } - @Nullable - public String getPath() { + public @Nullable String getPath() { return myFile != null ? myFile.getName() : myURL != null ? myURL.toString() : null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Repository.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Repository.java index a3d262b22d3c..437cb2bfd877 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Repository.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/Repository.java @@ -1,18 +1,17 @@ -// 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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; public class Repository { - @NotNull private final Url myUrl; + private final @NotNull Url myUrl; public Repository(@NotNull Url url) { myUrl = url; } - @NotNull - public Url getUrl() { + public @NotNull Url getUrl() { return myUrl; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/UrlMappingRepositoryProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/UrlMappingRepositoryProvider.java index 3fe9363f0854..0e846eda44fa 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/api/UrlMappingRepositoryProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/api/UrlMappingRepositoryProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.api; import org.jetbrains.annotations.NotNull; @@ -28,9 +14,8 @@ public class UrlMappingRepositoryProvider extends BaseRepositoryProvider { super(vcs, target); } - @Nullable @Override - public Repository get() { + public @Nullable Repository get() { RootUrlInfo rootInfo = null; if (!myVcs.getProject().isDefault()) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AcceptResult.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AcceptResult.java index 4dde1d1f9c89..e0080aa2af44 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AcceptResult.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AcceptResult.java @@ -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 org.jetbrains.idea.svn.auth; import org.jetbrains.annotations.NotNull; @@ -26,7 +12,7 @@ public enum AcceptResult { // cache all values as values() method returns new array on each call private static final AcceptResult[] allValues = values(); - @NotNull private final String code; + private final @NotNull String code; AcceptResult(@NotNull String code) { this.code = code; @@ -37,8 +23,7 @@ public enum AcceptResult { return code; } - @NotNull - public static AcceptResult from(int value) { + public static @NotNull AcceptResult from(int value) { if (value < 0 || value >= allValues.length) { throw new IllegalArgumentException("Unknown AcceptResult - " + value); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java index 79015611e27f..db29ca9f3a9e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java @@ -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 org.jetbrains.idea.svn.auth; import com.intellij.openapi.diagnostic.Logger; @@ -29,9 +29,9 @@ public class CertificateTrustManager extends ClientOnlyTrustManager { private static final @NonNls String CMD_SSL_SERVER = "cmd.ssl.server"; - @NotNull private final AuthenticationService myAuthenticationService; - @NotNull private final Url myRepositoryUrl; - @NotNull private final String myRealm; + private final @NotNull AuthenticationService myAuthenticationService; + private final @NotNull Url myRepositoryUrl; + private final @NotNull String myRealm; public CertificateTrustManager(@NotNull AuthenticationService authenticationService, @NotNull Url repositoryUrl) { myAuthenticationService = authenticationService; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java index 7137ebdbeba8..6ad9fa3aa60d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnAuthenticationManager.java @@ -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 org.jetbrains.idea.svn.auth; import com.intellij.openapi.project.Project; @@ -67,8 +67,7 @@ public final class SvnAuthenticationManager { return myProvider; } - @NotNull - public HostOptions getHostOptions(@NotNull Url url) { + public @NotNull HostOptions getHostOptions(@NotNull Url url) { return new HostOptions(url); } @@ -78,8 +77,8 @@ public final class SvnAuthenticationManager { SvnConfiguration.getInstance(myProject).acknowledge(kind, realm, proxy); } - private final static int DEFAULT_READ_TIMEOUT = 30 * 1000; - private final static int DEFAULT_CONNECT_TIMEOUT = 60 * 1000; + private static final int DEFAULT_READ_TIMEOUT = 30 * 1000; + private static final int DEFAULT_CONNECT_TIMEOUT = 60 * 1000; public int getReadTimeout(@NotNull Url url) { String protocol = url.getProtocol(); @@ -116,7 +115,7 @@ public final class SvnAuthenticationManager { } public final class HostOptions { - @NotNull private final Url myUrl; + private final @NotNull Url myUrl; private HostOptions(@NotNull Url url) { myUrl = url; @@ -136,8 +135,7 @@ public final class SvnAuthenticationManager { return storageEnabled; } - @Nullable - public String getSSLClientCertFile() { + public @Nullable String getSSLClientCertFile() { return getPropertyIdea(myUrl.getHost(), myServersFile.getValue(), "ssl-client-cert-file"); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnInteractiveAuthenticationProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnInteractiveAuthenticationProvider.java index 53450b09dba1..9c07df6b05d5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnInteractiveAuthenticationProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/SvnInteractiveAuthenticationProvider.java @@ -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 org.jetbrains.idea.svn.auth; import com.intellij.openapi.application.ModalityState; @@ -22,8 +22,8 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnInteractiveAuthenticationProvider implements AuthenticationProvider { private static final Logger LOG = Logger.getInstance(SvnInteractiveAuthenticationProvider.class); - @NotNull private final SvnVcs myVcs; - @NotNull private final Project myProject; + private final @NotNull SvnVcs myVcs; + private final @NotNull Project myProject; private static final ThreadLocal myCallState = new ThreadLocal<>(); private final SvnAuthenticationManager myManager; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchConfigurationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchConfigurationDialog.java index ec6c97cf786f..c9ecfe22a952 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchConfigurationDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchConfigurationDialog.java @@ -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 org.jetbrains.idea.svn.branchConfig; @@ -38,12 +38,12 @@ public class BranchConfigurationDialog extends DialogWrapper { private JPanel myTopPanel; private TextFieldWithBrowseButton myTrunkLocationTextField; private final JBList myBranchLocationsList; - @NotNull private final SortedListModel myBranchLocationsModel = new SortedListModel<>(comparing(Url::toDecodedString)); + private final @NotNull SortedListModel myBranchLocationsModel = new SortedListModel<>(comparing(Url::toDecodedString)); private JPanel myListPanel; - @NotNull private final NewRootBunch mySvnBranchConfigManager; - @NotNull private final VirtualFile myRoot; - @NotNull private final Url myRootUrl; - @NotNull private final SvnBranchConfigurationNew myConfiguration; + private final @NotNull NewRootBunch mySvnBranchConfigManager; + private final @NotNull VirtualFile myRoot; + private final @NotNull Url myRootUrl; + private final @NotNull SvnBranchConfigurationNew myConfiguration; private Url myTrunkUrl; public BranchConfigurationDialog(@NotNull Project project, @@ -80,9 +80,8 @@ public class BranchConfigurationDialog extends DialogWrapper { myListPanel.add(wrapLocationsWithToolbar(project, rootUrl), BorderLayout.CENTER); } - @Nullable @Override - protected ValidationInfo doValidate() { + protected @Nullable ValidationInfo doValidate() { try { myTrunkUrl = createUrl(myTrunkLocationTextField.getText(), false); } @@ -105,12 +104,11 @@ public class BranchConfigurationDialog extends DialogWrapper { super.doOKAction(); } - @NotNull - private JPanel wrapLocationsWithToolbar(@NotNull Project project, @NotNull Url rootUrl) { + private @NotNull JPanel wrapLocationsWithToolbar(@NotNull Project project, @NotNull Url rootUrl) { return ToolbarDecorator.createDecorator(myBranchLocationsList) .setAddAction(new AnActionButtonRunnable() { - @Nullable private Url usedRootUrl; + private @Nullable Url usedRootUrl; @Override public void run(AnActionButton button) { @@ -144,14 +142,12 @@ public class BranchConfigurationDialog extends DialogWrapper { } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myTopPanel; } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "Subversion.BranchConfigurationDialog"; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java index 4bb77622b190..f7df1d0f33b8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/BranchesLoader.java @@ -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 org.jetbrains.idea.svn.branchConfig; import com.intellij.openapi.project.Project; @@ -22,11 +22,11 @@ import static com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier.showOverChan import static org.jetbrains.idea.svn.SvnBundle.message; public class BranchesLoader implements Runnable { - @NotNull private final Project myProject; - @NotNull private final NewRootBunch myBunch; - @NotNull private final VirtualFile myRoot; - @NotNull private final Url myUrl; - @NotNull private final InfoReliability myInfoReliability; + private final @NotNull Project myProject; + private final @NotNull NewRootBunch myBunch; + private final @NotNull VirtualFile myRoot; + private final @NotNull Url myUrl; + private final @NotNull InfoReliability myInfoReliability; private final boolean myPassive; public BranchesLoader(@NotNull Project project, @@ -54,8 +54,7 @@ public class BranchesLoader implements Runnable { } } - @NotNull - public List loadBranches() throws VcsException { + public @NotNull List loadBranches() throws VcsException { SvnVcs vcs = SvnVcs.getInstance(myProject); List result = new LinkedList<>(); Target target = Target.on(myUrl); @@ -74,8 +73,7 @@ public class BranchesLoader implements Runnable { } } - @NotNull - private static DirectoryEntryConsumer createConsumer(@NotNull final List result) { + private static @NotNull DirectoryEntryConsumer createConsumer(final @NotNull List result) { return entry -> { if (entry.getDate() != null) { result.add(new SvnBranchItem(entry.getUrl(), entry.getDate().getTime(), entry.getRevision())); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagAction.java index 2c03071231ec..fc0aaa20e296 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagAction.java @@ -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 org.jetbrains.idea.svn.branchConfig; @@ -39,9 +39,8 @@ import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnUtil.removePathTail; public class CreateBranchOrTagAction extends BasicAction { - @NotNull @Override - protected String getActionName() { + protected @NotNull String getActionName() { return message("action.Subversion.Copy.text"); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagDialog.java index c787f6a514b8..67f8100a5718 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/CreateBranchOrTagDialog.java @@ -8,7 +8,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.ui.ValidationInfo; -import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.CollectionComboBoxModel; @@ -48,10 +47,10 @@ import static org.jetbrains.idea.svn.SvnUtil.removePathTail; import static org.jetbrains.idea.svn.branchConfig.BranchConfigurationDialog.DECODED_URL_RENDERER; public class CreateBranchOrTagDialog extends DialogWrapper { - @NotNull private final File mySrcFile; - @NotNull private final Url mySrcURL; - @NotNull private final SvnVcs myVcs; - @NotNull private final Project myProject; + private final @NotNull File mySrcFile; + private final @NotNull Url mySrcURL; + private final @NotNull SvnVcs myVcs; + private final @NotNull Project myProject; private TextFieldWithBrowseButton myToURLText; @@ -63,7 +62,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { private TextFieldWithBrowseButton myRepositoryField; private SvnRevisionPanel myRevisionPanel; private ComboboxWithBrowseButton myBranchTagBaseComboBox; - @NotNull private final CollectionComboBoxModel myBranchTagBaseModel = new CollectionComboBoxModel<>(); + private final @NotNull CollectionComboBoxModel myBranchTagBaseModel = new CollectionComboBoxModel<>(); private JTextField myBranchTextField; private JRadioButton myBranchOrTagRadioButton; private JRadioButton myAnyLocationRadioButton; @@ -71,7 +70,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { private JLabel myUseThisVariantToLabel; private JBCheckBox mySwitchOnCreate; - @NonNls private static final String HELP_ID = "vcs.subversion.branch"; + private static final @NonNls String HELP_ID = "vcs.subversion.branch"; private SvnBranchConfigurationNew myBranchConfiguration; private final VirtualFile mySrcVirtualFile; private final Url myWcRootUrl; @@ -102,7 +101,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { .withDescription(message("label.select.location.to.copy.from"))); myWorkingCopyField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { updateSwitchOnCreate(); updateControls(); } @@ -115,7 +114,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { }); myRepositoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { updateToURL(); } }); @@ -159,7 +158,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { updateControls(); myBranchTextField.getDocument().addDocumentListener(new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { updateToURL(); } }); @@ -221,9 +220,8 @@ public class CreateBranchOrTagDialog extends DialogWrapper { myUseThisVariantToLabel.setForeground(myWorkingCopyRadioButton.isSelected() ? UIUtil.getActiveTextColor() : NamedColorUtil.getInactiveTextColor()); } - @Nullable @Override - protected String getHelpId() { + protected @Nullable String getHelpId() { return HELP_ID; } @@ -257,8 +255,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { } } - @Nullable - private Url getRepositoryFieldUrl() { + private @Nullable Url getRepositoryFieldUrl() { try { return createUrl(myRepositoryField.getText(), false); } @@ -287,15 +284,13 @@ public class CreateBranchOrTagDialog extends DialogWrapper { return false; } - @Nullable @Override - protected ValidationInfo doValidate() { + protected @Nullable ValidationInfo doValidate() { ValidationInfo info = validateSource(); return info != null ? info : validateDestination(); } - @Nullable - private ValidationInfo validateSource() { + private @Nullable ValidationInfo validateSource() { if (myRepositoryRadioButton.isSelected()) { Url url = getRepositoryFieldUrl(); if (url == null) { @@ -316,8 +311,7 @@ public class CreateBranchOrTagDialog extends DialogWrapper { return null; } - @Nullable - private ValidationInfo validateDestination() { + private @Nullable ValidationInfo validateDestination() { if (myBranchOrTagRadioButton.isSelected()) { Url branchLocation = myBranchTagBaseModel.getSelected(); if (branchLocation == null) { @@ -351,18 +345,15 @@ public class CreateBranchOrTagDialog extends DialogWrapper { return mySwitchOnCreate.isSelected(); } - @Nullable - public Target getSource() { + public @Nullable Target getSource() { return mySource; } - @NotNull - public File getSourceFile() { + public @NotNull File getSourceFile() { return myRepositoryRadioButton.isSelected() ? mySrcFile : new File(myWorkingCopyField.getText()); } - @Nullable - public Url getDestination() { + public @Nullable Url getDestination() { return myDestination; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultBranchConfig.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultBranchConfig.java index 4f380c4f196f..d81a6e873e1d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultBranchConfig.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/DefaultBranchConfig.java @@ -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 org.jetbrains.idea.svn.branchConfig; import com.intellij.openapi.diagnostic.Logger; @@ -31,8 +31,7 @@ public final class DefaultBranchConfig { public static final @NlsSafe String BRANCHES_NAME = "branches"; public static final @NlsSafe String TAGS_NAME = "tags"; - @Nullable - public static SvnBranchConfigurationNew detect(@NotNull Project project, @NotNull VirtualFile root) { + public static @Nullable SvnBranchConfigurationNew detect(@NotNull Project project, @NotNull VirtualFile root) { SvnBranchConfigurationNew result = null; SvnVcs vcs = SvnVcs.getInstance(project); Url rootUrl = SvnUtil.getUrl(vcs, VfsUtilCore.virtualToIoFile(root)); @@ -52,8 +51,7 @@ public final class DefaultBranchConfig { return result; } - @NotNull - private static SvnBranchConfigurationNew detect(@NotNull SvnVcs vcs, @NotNull Url url) throws VcsException { + private static @NotNull SvnBranchConfigurationNew detect(@NotNull SvnVcs vcs, @NotNull Url url) throws VcsException { SvnBranchConfigurationNew result = new SvnBranchConfigurationNew(); result.setTrunk(url); @@ -67,8 +65,7 @@ public final class DefaultBranchConfig { return result; } - @Nullable - private static Url getBranchLocationsParent(@NotNull Url url) throws SvnBindException { + private static @Nullable Url getBranchLocationsParent(@NotNull Url url) throws SvnBindException { while (!hasEmptyName(url) && !hasDefaultName(url)) { url = removePathTail(url); } @@ -85,8 +82,7 @@ public final class DefaultBranchConfig { return name.equalsIgnoreCase(TRUNK_NAME) || name.equalsIgnoreCase(BRANCHES_NAME) || name.equalsIgnoreCase(TAGS_NAME); } - @NotNull - private static DirectoryEntryConsumer createHandler(@NotNull final SvnBranchConfigurationNew result, @NotNull final Url rootPath) { + private static @NotNull DirectoryEntryConsumer createHandler(final @NotNull SvnBranchConfigurationNew result, final @NotNull Url rootPath) { return entry -> { if (entry.isDirectory()) { Url childUrl = append(rootPath, entry.getName()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SelectBranchPopup.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SelectBranchPopup.java index 228829f245e7..4fcb5863facd 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SelectBranchPopup.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SelectBranchPopup.java @@ -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 org.jetbrains.idea.svn.branchConfig; import com.intellij.openapi.progress.ProgressIndicator; @@ -95,11 +95,11 @@ public final class SelectBranchPopup { } private static class BranchBasesPopupStep extends BaseListPopupStep { - @NotNull private final Project myProject; - @NotNull private final VirtualFile myVcsRoot; - @NotNull private final SvnBranchConfigurationNew myConfiguration; - @NotNull private final BranchSelectedCallback myCallback; - @Nullable private final Component myComponent; + private final @NotNull Project myProject; + private final @NotNull VirtualFile myVcsRoot; + private final @NotNull SvnBranchConfigurationNew myConfiguration; + private final @NotNull BranchSelectedCallback myCallback; + private final @Nullable Component myComponent; BranchBasesPopupStep(@NotNull Project project, @NotNull VirtualFile vcsRoot, @@ -121,9 +121,8 @@ public final class SelectBranchPopup { return getConfigureMessage().equals(value) ? new ListSeparator("") : null; } - @NotNull @Override - public String getTextFor(@NotNull Object value) { + public @NotNull String getTextFor(@NotNull Object value) { if (value instanceof Url url) { String suffix = url.equals(myConfiguration.getTrunk()) ? " (" + TRUNK_NAME + ")" : ELLIPSIS; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfiguration.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfiguration.java index 19612f2e6d06..06cdc2e782ca 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfiguration.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchConfiguration.java @@ -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 org.jetbrains.idea.svn.branchConfig; @@ -14,7 +14,7 @@ import java.util.List; @SuppressWarnings("UnusedDeclaration") public class SvnBranchConfiguration { private String myTrunkUrl; - @NotNull private List myBranchUrls; + private @NotNull List myBranchUrls; private boolean myUserinfoInUrl; public SvnBranchConfiguration() { @@ -49,8 +49,7 @@ public class SvnBranchConfiguration { return myTrunkUrl; } - @NotNull - public List getBranchUrls() { + public @NotNull List getBranchUrls() { return myBranchUrls; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java index aa1b60c21a58..6fd10c9c969f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java @@ -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 org.jetbrains.idea.svn.browse; import com.intellij.openapi.vcs.VcsException; @@ -116,8 +116,7 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient { public Lock.Builder lock; - @NotNull - public DirectoryEntry toDirectoryEntry(@NotNull Url url, @Nullable Url repositoryUrl) throws SvnBindException { + public @NotNull DirectoryEntry toDirectoryEntry(@NotNull Url url, @Nullable Url repositoryUrl) throws SvnBindException { return new DirectoryEntry(append(url, name), repositoryUrl, PathUtil.getFileName(name), kind, commit != null ? commit.build() : null, name); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java index ec6a51443e9a..fb38c654b6de 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/DirectoryEntry.java @@ -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 org.jetbrains.idea.svn.browse; import com.intellij.openapi.util.NlsSafe; @@ -21,7 +21,7 @@ public class DirectoryEntry extends BaseNodeDescription implements Comparable entry.getUrl().toDecodedString(), String.CASE_INSENSITIVE_ORDER); private final String myName; - @NotNull private final CommitInfo myCommitInfo; + private final @NotNull CommitInfo myCommitInfo; private final String myPath; private final Url myUrl; private final Url myRepositoryRoot; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java index 0da25e7c9733..6392b51aea35 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CmdCheckinClient.java @@ -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 org.jetbrains.idea.svn.checkin; import com.intellij.execution.process.ProcessOutputTypes; @@ -80,8 +80,7 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient { return revision; } - @NotNull - private List filterCommittables(@NotNull List committables) throws SvnBindException { + private @NotNull List filterCommittables(@NotNull List committables) throws SvnBindException { final Set childrenOfSomebody = new HashSet<>(); new AbstractFilterChildren() { @Override @@ -136,7 +135,7 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient { private static final String PATH = "\\s*(.*?)\\s*"; private static final Pattern CHANGED_PATH = Pattern.compile(STATUS + OPTIONAL_FILE_TYPE + PATH); - @Nullable private final CommitEventHandler myHandler; + private final @Nullable CommitEventHandler myHandler; private SvnBindException myException; private long myCommittedRevision = INVALID_REVISION_NUMBER; private File myBase; @@ -240,8 +239,7 @@ public class CmdCheckinClient extends BaseSvnClient implements CheckinClient { } } - @NotNull - private File toFile(@NotNull String path) { + private @NotNull File toFile(@NotNull String path) { return SvnUtil.resolvePath(myBase, path); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java index b41086748247..419666b942d4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/CommitInfo.java @@ -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 org.jetbrains.idea.svn.checkin; import com.intellij.openapi.util.NlsSafe; @@ -13,7 +13,7 @@ public final class CommitInfo { public static final CommitInfo EMPTY = new CommitInfo.Builder().setRevisionNumber(-1).build(); private final long myRevisionNumber; - @NotNull private final Revision myRevision; + private final @NotNull Revision myRevision; private final Date myDate; private final String myAuthor; @@ -28,8 +28,7 @@ public final class CommitInfo { return myRevisionNumber; } - @NotNull - public Revision getRevision() { + public @NotNull Revision getRevision() { return myRevision; } @@ -76,26 +75,22 @@ public final class CommitInfo { return date; } - @NotNull - public Builder setRevisionNumber(long revisionNumber) { + public @NotNull Builder setRevisionNumber(long revisionNumber) { this.revisionNumber = revisionNumber; return this; } - @NotNull - public Builder setAuthor(String author) { + public @NotNull Builder setAuthor(String author) { this.author = author; return this; } - @NotNull - public Builder setDate(Date date) { + public @NotNull Builder setDate(Date date) { this.date = date; return this; } - @NotNull - public CommitInfo build() { + public @NotNull CommitInfo build() { return new CommitInfo(this); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java index f7ed2d1fc919..94427c2dee28 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/IdeaCommitHandler.java @@ -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 org.jetbrains.idea.svn.checkin; import com.intellij.openapi.application.ReadAction; @@ -23,8 +23,8 @@ public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker { private static final Logger LOG = Logger.getInstance(IdeaCommitHandler.class); - @Nullable private final ProgressIndicator myProgress; - @NotNull private final List myDeletedFiles = new ArrayList<>(); + private final @Nullable ProgressIndicator myProgress; + private final @NotNull List myDeletedFiles = new ArrayList<>(); private final boolean myCheckCancel; private final boolean myTrackDeletedFiles; @@ -38,8 +38,7 @@ public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker { myTrackDeletedFiles = trackDeletedFiles; } - @NotNull - public List getDeletedFiles() { + public @NotNull List getDeletedFiles() { return myDeletedFiles; } @@ -95,7 +94,7 @@ public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker { } private void trackDeletedFile(@NotNull ProgressEvent event) { - @NonNls final String filePath = "file://" + event.getFile().getAbsolutePath().replace(File.separatorChar, '/'); + final @NonNls String filePath = "file://" + event.getFile().getAbsolutePath().replace(File.separatorChar, '/'); VirtualFile virtualFile = ReadAction.compute(() -> VirtualFileManager.getInstance().findFileByUrl(filePath)); @@ -104,8 +103,7 @@ public class IdeaCommitHandler implements CommitEventHandler, ProgressTracker { } } - @NotNull - private static CommitEventType convert(@NotNull EventAction action) { + private static @NotNull CommitEventType convert(@NotNull EventAction action) { CommitEventType result = CommitEventType.unknown; if (EventAction.COMMIT_ADDED.equals(action)) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java index 2ffa172e8c8e..bc1396c491da 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinEnvironment.java @@ -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 org.jetbrains.idea.svn.checkin; import com.intellij.openapi.application.ApplicationManager; @@ -32,26 +32,23 @@ import org.jetbrains.idea.svn.status.Status; import org.jetbrains.idea.svn.status.StatusType; import java.io.File; -import java.util.List; import java.util.*; public final class SvnCheckinEnvironment implements CheckinEnvironment { private static final Logger LOG = Logger.getInstance(SvnCheckinEnvironment.class); - @NotNull private final SvnVcs mySvnVcs; + private final @NotNull SvnVcs mySvnVcs; public SvnCheckinEnvironment(@NotNull SvnVcs svnVcs) { mySvnVcs = svnVcs; } - @NotNull @Override - public RefreshableOnComponent createCommitOptions(@NotNull CheckinProjectPanel commitPanel, @NotNull CommitContext commitContext) { + public @NotNull RefreshableOnComponent createCommitOptions(@NotNull CheckinProjectPanel commitPanel, @NotNull CommitContext commitContext) { return new KeepLocksComponent(mySvnVcs); } @Override - @Nullable - public String getHelpId() { + public @Nullable String getHelpId() { return null; } @@ -98,8 +95,7 @@ public final class SvnCheckinEnvironment implements CheckinEnvironment { } } - @NotNull - private Collection getCommitables(@NotNull List changes) { + private @NotNull Collection getCommitables(@NotNull List changes) { Set result = CollectionFactory.createCustomHashingStrategySet(ChangesUtil.CASE_SENSITIVE_FILE_PATH_HASHING_STRATEGY); ChangesUtil.getPaths(changes).forEach(path -> { if (result.add(path)) { @@ -123,8 +119,7 @@ public final class SvnCheckinEnvironment implements CheckinEnvironment { return status != null && status.is(StatusType.STATUS_ADDED, StatusType.STATUS_REPLACED); } - @Nullable - private Status getStatus(@NotNull FilePath file) { + private @Nullable Status getStatus(@NotNull FilePath file) { Status result = null; try { @@ -142,12 +137,11 @@ public final class SvnCheckinEnvironment implements CheckinEnvironment { return SvnBundle.message("checkin.operation.name"); } - @NotNull @Override - public List commit(@NotNull List changes, - @NotNull String commitMessage, - @NotNull CommitContext commitContext, - @NotNull Set feedback) { + public @NotNull List commit(@NotNull List changes, + @NotNull String commitMessage, + @NotNull CommitContext commitContext, + @NotNull Set feedback) { final List exception = new ArrayList<>(); final Collection committables = getCommitables(changes); final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java index ef66279d15d9..15e525dbf0f2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkin/SvnCheckinHandlerFactory.java @@ -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 org.jetbrains.idea.svn.checkin; import com.intellij.openapi.application.ApplicationManager; @@ -38,9 +38,8 @@ public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory { super(SvnVcs.getKey()); } - @NotNull @Override - protected CheckinHandler createVcsHandler(@NotNull CheckinProjectPanel panel, @NotNull CommitContext commitContext) { + protected @NotNull CheckinHandler createVcsHandler(@NotNull CheckinProjectPanel panel, @NotNull CommitContext commitContext) { final Project project = panel.getProject(); return new CheckinHandler() { @Override @@ -100,8 +99,7 @@ public class SvnCheckinHandlerFactory extends VcsCheckinHandlerFactory { }; } - @NotNull - private static MultiMap splitIntoCopies(@NotNull SvnVcs vcs, @NotNull Collection changes) { + private static @NotNull MultiMap splitIntoCopies(@NotNull SvnVcs vcs, @NotNull Collection changes) { MultiMap result = MultiMap.createSet(); SvnFileUrlMapping mapping = vcs.getSvnFileUrlMapping(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java index 4708f9cefc64..e8a85ca60c1c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/CheckoutEventHandler.java @@ -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 org.jetbrains.idea.svn.checkout; import com.intellij.openapi.progress.ProcessCanceledException; @@ -17,9 +17,9 @@ import org.jetbrains.idea.svn.api.ProgressTracker; import static org.jetbrains.idea.svn.SvnBundle.message; public class CheckoutEventHandler implements ProgressTracker { - @Nullable private final ProgressIndicator myIndicator; + private final @Nullable ProgressIndicator myIndicator; private int myExternalsCount; - @NotNull private final SvnVcs myVCS; + private final @NotNull SvnVcs myVCS; private final boolean myIsExport; private int myCnt; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java index a3eae5eb47ad..4a325f672a6e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java @@ -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 org.jetbrains.idea.svn.checkout; import com.intellij.openapi.application.ModalityState; @@ -57,7 +57,7 @@ import static org.jetbrains.idea.svn.WorkingCopyFormat.UNKNOWN; public class SvnCheckoutProvider implements CheckoutProvider { @Override - public void doCheckout(@NotNull final Project project, Listener listener) { + public void doCheckout(final @NotNull Project project, Listener listener) { // TODO: Several dialogs is invoked while dialog.show() - seems code should be rewritten to be more transparent CheckoutDialog dialog = new CheckoutDialog(project, listener); dialog.show(); @@ -81,8 +81,7 @@ public class SvnCheckoutProvider implements CheckoutProvider { } } - @NotNull - public static ClientFactory getFactory(@NotNull SvnVcs vcs) { + public static @NotNull ClientFactory getFactory(@NotNull SvnVcs vcs) { return vcs.getFactoryFromSettings(); } @@ -101,9 +100,8 @@ public class SvnCheckoutProvider implements CheckoutProvider { CloneTask cloneTask = new CloneTask() { final Ref checkoutSuccessful = new Ref<>(); - @NotNull @Override - public CloneTaskInfo taskInfo() { + public @NotNull CloneTaskInfo taskInfo() { return new CloneTaskInfo(message("progress.title.check.out"), message("progress.title.check.out.cancel"), message("checkout.repository"), @@ -114,9 +112,8 @@ public class SvnCheckoutProvider implements CheckoutProvider { message("checkout.stop.message.description", url.toString())); } - @NotNull @Override - public CloneStatus run(@NotNull ProgressIndicator indicator) { + public @NotNull CloneStatus run(@NotNull ProgressIndicator indicator) { WorkingCopyFormat format = selectedFormat == null ? UNKNOWN : selectedFormat; SvnVcs vcs = SvnVcs.getInstance(project); ProgressTracker handler = new CheckoutEventHandler(vcs, false, ProgressManager.getInstance().getProgressIndicator()); @@ -174,8 +171,7 @@ public class SvnCheckoutProvider implements CheckoutProvider { } @RequiresEdt - @NotNull - public static WorkingCopyFormat promptForWCopyFormat(@NotNull File target, @NotNull Project project) { + public static @NotNull WorkingCopyFormat promptForWCopyFormat(@NotNull File target, @NotNull Project project) { return new CheckoutFormatFromUserProvider(project, target).prompt(); } @@ -248,8 +244,8 @@ public class SvnCheckoutProvider implements CheckoutProvider { } private static final class MyFilter implements Predicate { - @NotNull private final LocalFileSystem myLfs = LocalFileSystem.getInstance(); - @NotNull private final SvnExcludingIgnoredOperation.Filter myFilter; + private final @NotNull LocalFileSystem myLfs = LocalFileSystem.getInstance(); + private final @NotNull SvnExcludingIgnoredOperation.Filter myFilter; private MyFilter(@NotNull SvnExcludingIgnoredOperation.Filter filter) { myFilter = filter; @@ -269,11 +265,11 @@ public class SvnCheckoutProvider implements CheckoutProvider { public static class CheckoutFormatFromUserProvider { - @NotNull private final Project myProject; - @NotNull private final SvnVcs myVcs; - @NotNull private final File myPath; + private final @NotNull Project myProject; + private final @NotNull SvnVcs myVcs; + private final @NotNull File myPath; - @NotNull private final AtomicReference error; + private final @NotNull AtomicReference error; public CheckoutFormatFromUserProvider(@NotNull Project project, @NotNull File path) { myProject = project; @@ -294,8 +290,7 @@ public class SvnCheckoutProvider implements CheckoutProvider { return result; } - @NotNull - private WorkingCopyFormat displayUpgradeDialog() { + private @NotNull WorkingCopyFormat displayUpgradeDialog() { final UpgradeFormatDialog dialog = new UpgradeFormatDialog(myProject, myPath, false); final ModalityState dialogState = any(); @@ -322,8 +317,7 @@ public class SvnCheckoutProvider implements CheckoutProvider { return dialog.showAndGet() ? dialog.getUpgradeMode() : UNKNOWN; } - @NotNull - private List loadSupportedFormats() { + private @NotNull List loadSupportedFormats() { List result = new ArrayList<>(); try { @@ -337,11 +331,10 @@ public class SvnCheckoutProvider implements CheckoutProvider { } } - @NotNull @Override - public VcsCloneComponent buildVcsCloneComponent(@NotNull Project project, - @NotNull ModalityState modalityState, - @NotNull VcsCloneDialogComponentStateListener dialogStateListener) { + public @NotNull VcsCloneComponent buildVcsCloneComponent(@NotNull Project project, + @NotNull ModalityState modalityState, + @NotNull VcsCloneDialogComponentStateListener dialogStateListener) { return new SvnCloneDialogExtension(project); } } \ No newline at end of file diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/AuthCallbackCase.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/AuthCallbackCase.java index dd111b8b46e2..7eb6bcb9ef53 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/AuthCallbackCase.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/AuthCallbackCase.java @@ -1,4 +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 org.jetbrains.idea.svn.commandLine; import org.jetbrains.annotations.NotNull; @@ -9,7 +9,7 @@ import static org.jetbrains.idea.svn.SvnUtil.createUrl; public abstract class AuthCallbackCase { protected final Url myUrl; - @NotNull protected final AuthenticationService myAuthenticationService; + protected final @NotNull AuthenticationService myAuthenticationService; AuthCallbackCase(@NotNull AuthenticationService authenticationService, Url url) { myAuthenticationService = authenticationService; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseCommandRuntimeModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseCommandRuntimeModule.java index ddb0064a75b7..a240f8481ace 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseCommandRuntimeModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseCommandRuntimeModule.java @@ -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 org.jetbrains.idea.svn.commandLine; import org.jetbrains.annotations.NotNull; @@ -21,9 +7,9 @@ import org.jetbrains.idea.svn.auth.AuthenticationService; public abstract class BaseCommandRuntimeModule implements CommandRuntimeModule { - @NotNull protected final CommandRuntime myRuntime; - @NotNull protected final AuthenticationService myAuthenticationService; - @NotNull protected final SvnVcs myVcs; + protected final @NotNull CommandRuntime myRuntime; + protected final @NotNull AuthenticationService myAuthenticationService; + protected final @NotNull SvnVcs myVcs; public BaseCommandRuntimeModule(@NotNull CommandRuntime runtime) { myRuntime = runtime; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java index d975a29c898a..5bf7c3b7d31e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.diagnostic.Logger; @@ -12,8 +12,8 @@ public abstract class BaseTerminalModule extends LineCommandAdapter implements C private static final Logger LOG = Logger.getInstance(BaseTerminalModule.class); - @NotNull protected final CommandRuntime myRuntime; - @NotNull protected final CommandExecutor myExecutor; + protected final @NotNull CommandRuntime myRuntime; + protected final @NotNull CommandExecutor myExecutor; protected boolean mySkipOneLine; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java index 08c977064121..6a1ae3c0a907 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseUpdateCommandListener.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.process.ProcessOutputTypes; @@ -29,14 +15,11 @@ import static org.jetbrains.idea.svn.api.BaseSvnClient.callHandler; public class BaseUpdateCommandListener extends LineCommandAdapter { - @NotNull - private final UpdateOutputLineConverter converter; + private final @NotNull UpdateOutputLineConverter converter; - @Nullable - private final ProgressTracker handler; + private final @Nullable ProgressTracker handler; - @NotNull - private final AtomicReference exception; + private final @NotNull AtomicReference exception; public BaseUpdateCommandListener(@NotNull File base, @Nullable ProgressTracker handler) { this.handler = handler; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java index e118f7243468..3365976ab352 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.NlsSafe; @@ -21,20 +21,19 @@ import java.util.List; // TODO: Probably make command immutable and use CommandBuilder for updates. public class Command { - @NotNull private final List myParameters = new ArrayList<>(); - @NotNull private final SvnCommandName myName; - @Nullable private PasswordAuthenticationData myAuthParameters = null; + private final @NotNull List myParameters = new ArrayList<>(); + private final @NotNull SvnCommandName myName; + private @Nullable PasswordAuthenticationData myAuthParameters = null; private File workingDirectory; - @Nullable private File myConfigDir; - @Nullable private LineCommandListener myResultBuilder; - @Nullable private volatile Url myRepositoryUrl; - @NotNull private Target myTarget; - @Unmodifiable - private Collection myTargets; - @Nullable private PropertyValue myPropertyValue; + private @Nullable File myConfigDir; + private @Nullable LineCommandListener myResultBuilder; + private volatile @Nullable Url myRepositoryUrl; + private @NotNull Target myTarget; + private @Unmodifiable Collection myTargets; + private @Nullable PropertyValue myPropertyValue; - @Nullable private ProgressTracker myCanceller; + private @Nullable ProgressTracker myCanceller; public Command(@NotNull SvnCommandName name) { myName = name; @@ -78,8 +77,7 @@ public class Command { myAuthParameters = authData; } - @Nullable - public ProgressTracker getCanceller() { + public @Nullable ProgressTracker getCanceller() { return myCanceller; } @@ -87,8 +85,7 @@ public class Command { myCanceller = canceller; } - @Nullable - public File getConfigDir() { + public @Nullable File getConfigDir() { return myConfigDir; } @@ -96,41 +93,34 @@ public class Command { return workingDirectory; } - @Nullable - public LineCommandListener getResultBuilder() { + public @Nullable LineCommandListener getResultBuilder() { return myResultBuilder; } - @Nullable - public Url getRepositoryUrl() { + public @Nullable Url getRepositoryUrl() { return myRepositoryUrl; } - @NotNull - public Url requireRepositoryUrl() { + public @NotNull Url requireRepositoryUrl() { Url result = getRepositoryUrl(); assert result != null; return result; } - @NotNull - public Target getTarget() { + public @NotNull Target getTarget() { return myTarget; } - @Nullable - public List getTargetsPaths() { + public @Nullable List getTargetsPaths() { return ContainerUtil.isEmpty(myTargets) ? null : ContainerUtil.map(myTargets, file -> CommandUtil.format(file.getAbsolutePath(), null)); } - @Nullable - public PropertyValue getPropertyValue() { + public @Nullable PropertyValue getPropertyValue() { return myPropertyValue; } - @NotNull - public SvnCommandName getName() { + public @NotNull SvnCommandName getName() { return myName; } @@ -162,13 +152,11 @@ public class Command { myPropertyValue = propertyValue; } - @NotNull - public List getParameters() { + public @NotNull List getParameters() { return new ArrayList<>(myParameters); } - @Nullable - public PasswordAuthenticationData getAuthParameters() { + public @Nullable PasswordAuthenticationData getAuthParameters() { return myAuthParameters; } @@ -209,8 +197,7 @@ public class Command { return is(SvnCommandName.cat) && hasLocalTarget() && isLocal(getRevision()); } - @Nullable - private Revision getRevision() { + private @Nullable Revision getRevision() { int index = myParameters.indexOf("--revision"); return index >= 0 && index + 1 < myParameters.size() ? Revision.parse(myParameters.get(index + 1)) : null; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java index 2fa1ada806a7..f148c446d657 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.ExecutionException; @@ -37,13 +37,13 @@ public class CommandExecutor { static final Logger LOG = Logger.getInstance(CommandExecutor.class.getName()); private final AtomicReference myExitCodeReference; - @Nullable private String myMessage; + private @Nullable String myMessage; private boolean myIsDestroyed; private boolean myNeedsDestroy; private volatile @DialogMessage String myDestroyReason; private volatile boolean myWasCancelled; - @NotNull private final List myTempFiles; - @NotNull protected final GeneralCommandLine myCommandLine; + private final @NotNull List myTempFiles; + protected final @NotNull GeneralCommandLine myCommandLine; protected Process myProcess; protected SvnProcessHandler myHandler; private OutputStreamWriter myProcessWriter; @@ -55,8 +55,8 @@ public class CommandExecutor { private final EventDispatcher myListeners = EventDispatcher.create(LineCommandListener.class); private final AtomicBoolean myWasError = new AtomicBoolean(false); - @Nullable private final LineCommandListener myResultBuilder; - @NotNull private final Command myCommand; + private final @Nullable LineCommandListener myResultBuilder; + private final @NotNull Command myCommand; public CommandExecutor(@NotNull @NonNls String exePath, @NotNull Command command) { myCommand = command; @@ -91,8 +91,7 @@ public class CommandExecutor { myExitCodeReference = new AtomicReference<>(); } - @NotNull - private List prepareParameters(@NotNull Command command) { + private @NotNull List prepareParameters(@NotNull Command command) { List parameters = command.getParameters(); detectAndRemoveMessage(parameters); @@ -157,10 +156,9 @@ public class CommandExecutor { myCommandLine.withEnvironment(VcsLocaleHelper.getDefaultLocaleEnvironmentVars("svn")); } - @NotNull - private File ensureCommandFile(@NonNls @NotNull String prefix, - @NotNull String data, - @NotNull String parameterName) throws SvnBindException { + private @NotNull File ensureCommandFile(@NonNls @NotNull String prefix, + @NotNull String data, + @NotNull String parameterName) throws SvnBindException { File result = createTempFile(prefix, ".txt"); myTempFiles.add(result); @@ -213,15 +211,13 @@ public class CommandExecutor { } } - @NotNull - protected static File getSvnFolder() { + protected static @NotNull File getSvnFolder() { File vcsFolder = new File(PathManager.getSystemPath(), "vcs"); return new File(vcsFolder, "svn"); } - @NotNull - protected static File createTempFile(@NonNls @NotNull String prefix, @NonNls @NotNull String extension) throws SvnBindException { + protected static @NotNull File createTempFile(@NonNls @NotNull String prefix, @NonNls @NotNull String extension) throws SvnBindException { try { return FileUtil.createTempFile(getSvnFolder(), prefix, extension); } @@ -240,8 +236,7 @@ public class CommandExecutor { } } - @NotNull - protected SvnProcessHandler createProcessHandler() { + protected @NotNull SvnProcessHandler createProcessHandler() { return new SvnProcessHandler(myProcess, myCommandLine, needsUtf8Output(), needsBinaryOutput()); } @@ -254,13 +249,11 @@ public class CommandExecutor { return myCommand.getParameters().contains("--xml"); } - @NotNull - protected GeneralCommandLine createCommandLine() { + protected @NotNull GeneralCommandLine createCommandLine() { return new GeneralCommandLine(); } - @NotNull - protected Process createProcess() throws ExecutionException { + protected @NotNull Process createProcess() throws ExecutionException { return myCommandLine.createProcess(); } @@ -285,14 +278,12 @@ public class CommandExecutor { return outputAdapter.getOutput(); } - @NotNull - public ByteArrayOutputStream getBinaryOutput() { + public @NotNull ByteArrayOutputStream getBinaryOutput() { return myHandler.getBinaryOutput(); } // TODO: Carefully here - do not modify command from threads other than the one started command execution - @NotNull - public Command getCommand() { + public @NotNull Command getCommand() { return myCommand; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandParametersResolutionModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandParametersResolutionModule.java index 3b27d361e477..06b7f28d1d83 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandParametersResolutionModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandParametersResolutionModule.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.project.Project; @@ -33,8 +33,7 @@ public class CommandParametersResolutionModule extends BaseCommandRuntimeModule command.setConfigDir(myAuthenticationService.getSpecialConfigDir().toFile()); } - @Nullable - private Url resolveRepositoryUrl(@NotNull Command command) { + private @Nullable Url resolveRepositoryUrl(@NotNull Command command) { UrlMappingRepositoryProvider urlMappingProvider = new UrlMappingRepositoryProvider(myVcs, command.getTarget()); InfoCommandRepositoryProvider infoCommandProvider = new InfoCommandRepositoryProvider(myVcs, command.getTarget()); @@ -46,16 +45,14 @@ public class CommandParametersResolutionModule extends BaseCommandRuntimeModule return repository != null ? repository.getUrl() : null; } - @NotNull - private File resolveWorkingDirectory(@NotNull Command command) { + private @NotNull File resolveWorkingDirectory(@NotNull Command command) { File file = command.getTarget().getFile(); RootUrlInfo root = file != null ? myVcs.getSvnFileUrlMapping().getWcRootForFilePath(getFilePath(file)) : null; return root != null ? root.getIoFile() : getDefaultWorkingDirectory(myVcs.getProject()); } - @NotNull - public static File getDefaultWorkingDirectory(@NotNull Project project) { + public static @NotNull File getDefaultWorkingDirectory(@NotNull Project project) { VirtualFile baseDir = project.getBaseDir(); return baseDir != null ? virtualToIoFile(baseDir) : CommandUtil.getHomeDirectory(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java index d9af799ff97e..afb240323452 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.ide.impl.TrustedProjects; @@ -26,9 +26,9 @@ public class CommandRuntime { private static final Logger LOG = Logger.getInstance(CommandRuntime.class); - @NotNull private final AuthenticationService myAuthenticationService; - @NotNull private final SvnVcs myVcs; - @NotNull private final List myModules; + private final @NotNull AuthenticationService myAuthenticationService; + private final @NotNull SvnVcs myVcs; + private final @NotNull List myModules; private final String exePath; public CommandRuntime(@NotNull SvnVcs vcs, @NotNull AuthenticationService authenticationService) { @@ -44,8 +44,7 @@ public class CommandRuntime { myModules.add(new SshTunnelRuntimeModule(this)); } - @NotNull - public CommandExecutor runWithAuthenticationAttempt(@NotNull Command command) throws SvnBindException { + public @NotNull CommandExecutor runWithAuthenticationAttempt(@NotNull Command command) throws SvnBindException { Project project = myVcs.getProject(); if (!project.isDefault() && !TrustedProjects.isTrusted(project)) { throw new IllegalStateException("Shouldn't be possible to run a SVN command in the safe mode"); @@ -67,8 +66,7 @@ public class CommandRuntime { } } - @NotNull - public CommandExecutor runLocal(@NotNull Command command, int timeout) throws SvnBindException { + public @NotNull CommandExecutor runLocal(@NotNull Command command, int timeout) throws SvnBindException { Project project = myVcs.getProject(); if (!project.isDefault() && !TrustedProjects.isTrusted(project)) { throw new IllegalStateException("Shouldn't be possible to run a SVN command in the safe mode"); @@ -176,8 +174,7 @@ public class CommandRuntime { } } - @Nullable - private AuthCallbackCase createCallback(@NotNull final String errText, @Nullable final Url url, boolean isUnderTerminal) { + private @Nullable AuthCallbackCase createCallback(final @NotNull String errText, final @Nullable Url url, boolean isUnderTerminal) { List authCases = new ArrayList<>(); if (isUnderTerminal) { @@ -219,8 +216,7 @@ public class CommandRuntime { } } - @NotNull - private CommandExecutor newExecutor(@NotNull Command command) { + private @NotNull CommandExecutor newExecutor(@NotNull Command command) { final CommandExecutor executor; if (!myVcs.getSvnConfiguration().isRunUnderTerminal() || isLocal(command)) { @@ -239,8 +235,7 @@ public class CommandRuntime { return executor; } - @NotNull - private TerminalExecutor newTerminalExecutor(@NotNull Command command) { + private @NotNull TerminalExecutor newTerminalExecutor(@NotNull Command command) { return SystemInfo.isWindows ? new WinTerminalExecutor(exePath, command) : new TerminalExecutor(exePath, command); @@ -259,13 +254,11 @@ public class CommandRuntime { command.isLocalInfo() || command.isLocalStatus() || command.isLocalProperty() || command.isLocalCat(); } - @NotNull - public AuthenticationService getAuthenticationService() { + public @NotNull AuthenticationService getAuthenticationService() { return myAuthenticationService; } - @NotNull - public SvnVcs getVcs() { + public @NotNull SvnVcs getVcs() { return myVcs; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java index 4803a604386d..dd4aa219873e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandUtil.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.application.PathManager; @@ -72,8 +72,7 @@ public final class CommandUtil { parameters.add(format(path, pegRevision)); } - @NotNull - public static String format(@NotNull String path, @Nullable Revision pegRevision) { + public static @NotNull String format(@NotNull String path, @Nullable Revision pegRevision) { StringBuilder builder = new StringBuilder(path); boolean hasAtSymbol = path.contains("@"); @@ -129,8 +128,7 @@ public final class CommandUtil { put(parameters, "--revision", format(startRevision) + ":" + format(endRevision)); } - @NotNull - public static String format(@NotNull Revision revision) { + public static @NotNull String format(@NotNull Revision revision) { var date = revision.getDate(); return date != null ? "{" + DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(date.toInstant().atZone(ZoneOffset.UTC)) + "}" : revision.toString(); } @@ -180,8 +178,7 @@ public final class CommandUtil { return (T)unmarshaller.unmarshal(new StringReader(data.trim())); } - @NotNull - public static File getHomeDirectory() { + public static @NotNull File getHomeDirectory() { return new File(PathManager.getHomePath()); } @@ -193,13 +190,11 @@ public final class CommandUtil { return !StringUtil.isEmpty(type) ? type.charAt(0) : ' '; } - @NotNull - public static StatusType getStatusType(@Nullable String type) { + public static @NotNull StatusType getStatusType(@Nullable String type) { return getStatusType(getStatusChar(type)); } - @NotNull - public static StatusType getStatusType(char first) { + public static @NotNull StatusType getStatusType(char first) { final StatusType contentsStatus; if ('A' == first) { contentsStatus = StatusType.STATUS_ADDED; @@ -221,8 +216,7 @@ public final class CommandUtil { return contentsStatus; } - @Nullable - public static File findExistingParent(@Nullable File file) { + public static @Nullable File findExistingParent(@Nullable File file) { while (file != null) { if (file.exists() && file.isDirectory()) return file; file = file.getParentFile(); @@ -230,8 +224,7 @@ public final class CommandUtil { return null; } - @NotNull - public static File requireExistingParent(@NotNull File file) { + public static @NotNull File requireExistingParent(@NotNull File file) { File result = findExistingParent(file); if (result == null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyCallback.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyCallback.java index a7a4f78c533e..761bd1adc7b2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyCallback.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyCallback.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.diagnostic.Logger; @@ -70,8 +70,7 @@ public class ProxyCallback extends AuthCallbackCase { } } - @NotNull - private static String getHostGroup(@NotNull String proxyHostParameter) { + private static @NotNull String getHostGroup(@NotNull String proxyHostParameter) { int start = proxyHostParameter.indexOf(":"); int finish = proxyHostParameter.indexOf(":", start + 1); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java index 024a27b8a44f..e86697f74919 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.text.StringUtil; @@ -38,8 +38,7 @@ public class ProxyModule extends BaseCommandRuntimeModule { } } - @NotNull - private String ensureGroupForHost(@NotNull Command command, @NotNull String host) { + private @NotNull String ensureGroupForHost(@NotNull Command command, @NotNull String host) { SvnIniFile configFile = new SvnIniFile(myAuthenticationService.getSpecialConfigDir()); String groupName = SvnIniFile.getGroupForHost(host, configFile); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ResultBuilderNotifier.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ResultBuilderNotifier.java index 8de4ef8c0391..d2c0a869139f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ResultBuilderNotifier.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ResultBuilderNotifier.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.process.ProcessAdapter; @@ -15,20 +15,20 @@ public class ResultBuilderNotifier extends ProcessAdapter { /** * the partial line from stdout stream */ - @NotNull private final StringBuilder myStdoutLine = new StringBuilder(); + private final @NotNull StringBuilder myStdoutLine = new StringBuilder(); /** * the partial line from stderr stream */ - @NotNull private final StringBuilder myStderrLine = new StringBuilder(); + private final @NotNull StringBuilder myStderrLine = new StringBuilder(); - @NotNull private final LineCommandListener myResultBuilder; + private final @NotNull LineCommandListener myResultBuilder; public ResultBuilderNotifier(@NotNull LineCommandListener resultBuilder) { myResultBuilder = resultBuilder; } @Override - public void processTerminated(@NotNull final ProcessEvent event) { + public void processTerminated(final @NotNull ProcessEvent event) { try { forceNewLine(); } finally { @@ -46,7 +46,7 @@ public class ResultBuilderNotifier extends ProcessAdapter { } @Override - public void onTextAvailable(@NotNull final ProcessEvent event, @NotNull final Key outputType) { + public void onTextAvailable(final @NotNull ProcessEvent event, final @NotNull Key outputType) { onTextAvailable(event.getText(), outputType); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java index e3b67c568d2e..7f0c0ca474bc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SshTunnelRuntimeModule.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.configurations.GeneralCommandLine; @@ -38,18 +38,15 @@ public class SshTunnelRuntimeModule extends BaseCommandRuntimeModule { } } - @NotNull - private SvnConfiguration getConfiguration() { + private @NotNull SvnConfiguration getConfiguration() { return myRuntime.getVcs().getSvnConfiguration(); } - @NotNull - private SvnConfigurationState getState() { + private @NotNull SvnConfigurationState getState() { return getConfiguration().getState(); } - @NotNull - private String buildTunnelValue() { + private @NotNull String buildTunnelValue() { String sshPath = getState().sshExecutablePath; sshPath = !isEmpty(sshPath) ? sshPath : getExecutablePath(getConfiguration().getSshTunnelSetting()); @@ -59,8 +56,7 @@ public class SshTunnelRuntimeModule extends BaseCommandRuntimeModule { return join(parameters, " "); } - @NotNull - private GeneralCommandLine buildTunnelCommandLine(@NotNull String sshPath) { + private @NotNull GeneralCommandLine buildTunnelCommandLine(@NotNull String sshPath) { GeneralCommandLine result = new GeneralCommandLine(sshPath); boolean isPuttyLinkClient = endsWithIgnoreCase(FileUtilRt.getNameWithoutExtension(sshPath), PUTTY_LINK_CLIENT_NAME); SvnConfigurationState state = getState(); @@ -83,8 +79,7 @@ public class SshTunnelRuntimeModule extends BaseCommandRuntimeModule { return result; } - @NotNull - public static String getSshTunnelValue(@Nullable String tunnelSetting) { + public static @NotNull String getSshTunnelValue(@Nullable String tunnelSetting) { tunnelSetting = !isEmpty(tunnelSetting) ? tunnelSetting : DEFAULT_SSH_TUNNEL_VALUE; String svnSshVariableName = getSvnSshVariableName(tunnelSetting); String svnSshVariableValue = EnvironmentUtil.getValue(svnSshVariableName); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java index 1292434a6139..63ca0d74cd09 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnBindException.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.Condition; @@ -23,8 +23,8 @@ import static org.jetbrains.idea.svn.api.ErrorCategory.categoryCodeOf; public final class SvnBindException extends VcsException { private static final @NlsSafe String ERROR_MESSAGE_FORMAT = "svn: E%d: %s"; - @NotNull private final MultiMap errors = MultiMap.create(); - @NotNull private final MultiMap warnings = MultiMap.create(); + private final @NotNull MultiMap errors = MultiMap.create(); + private final @NotNull MultiMap warnings = MultiMap.create(); public SvnBindException(@NotNull ErrorCode code, @Nls @NotNull String message) { super(String.format(ERROR_MESSAGE_FORMAT, code.getCode(), message)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExecutableChecker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExecutableChecker.java index 3e3504c7253d..00e61592d33e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExecutableChecker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnExecutableChecker.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.ExecutableValidator; @@ -41,7 +41,7 @@ public final class SvnExecutableChecker extends ExecutableValidator implements D "^.*cannot set .* locale.*please check that your locale name is correct$", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL); - @NotNull private final SvnVcs myVcs; + private final @NotNull SvnVcs myVcs; public SvnExecutableChecker(@NotNull Project project) { super(project, @@ -67,9 +67,8 @@ public final class SvnExecutableChecker extends ExecutableValidator implements D return SvnApplicationSettings.getInstance().getCommandLinePath(); } - @NotNull @Override - protected String getConfigurableDisplayName() { + protected @NotNull String getConfigurableDisplayName() { return SvnConfigurable.getGroupDisplayName(); } @@ -97,8 +96,7 @@ public final class SvnExecutableChecker extends ExecutableValidator implements D } @Override - @Nullable - protected Notification validate(@NotNull String executable) { + protected @Nullable Notification validate(@NotNull String executable) { Notification result = createDefaultNotification(); // Necessary executable path will be taken from settings while command execution @@ -119,15 +117,13 @@ public final class SvnExecutableChecker extends ExecutableValidator implements D return result; } - @Nullable - private Notification validateVersion(@NotNull Version version) { + private @Nullable Notification validateVersion(@NotNull Version version) { return !myVcs.isSupportedByCommandLine(WorkingCopyFormat.from(version)) ? new ExecutableNotValidNotification(message("subversion.executable.too.old", version)) : null; } - @Nullable - private Notification validateLocale() throws SvnBindException { + private @Nullable Notification validateLocale() throws SvnBindException { ProcessOutput versionOutput = getVersionClient().runCommand(false); Notification result = null; @@ -148,8 +144,7 @@ public final class SvnExecutableChecker extends ExecutableValidator implements D return result; } - @Nullable - private Version getConfiguredClientVersion() { + private @Nullable Version getConfiguredClientVersion() { Version result = null; try { @@ -162,8 +157,7 @@ public final class SvnExecutableChecker extends ExecutableValidator implements D return result; } - @NotNull - private CmdVersionClient getVersionClient() { + private @NotNull CmdVersionClient getVersionClient() { return (CmdVersionClient)myVcs.getCommandLineFactory().createVersionClient(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnProcessHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnProcessHandler.java index 974752cb3408..4e6bbe8977ca 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnProcessHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/SvnProcessHandler.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.configurations.GeneralCommandLine; @@ -22,7 +22,7 @@ public class SvnProcessHandler extends OSProcessHandler { private final List myCommandLineList; private final boolean myForceUtf8; private final boolean myForceBinary; - @NotNull private final ByteArrayOutputStream myBinaryOutput; + private final @NotNull ByteArrayOutputStream myBinaryOutput; public SvnProcessHandler(@NotNull Process process, @NotNull GeneralCommandLine commandLine, boolean forceUtf8, boolean forceBinary) { super(process, commandLine.getCommandLineString()); @@ -39,20 +39,17 @@ public class SvnProcessHandler extends OSProcessHandler { return ParametersListUtil.join(myCommandLineList); } - @NotNull - public ByteArrayOutputStream getBinaryOutput() { + public @NotNull ByteArrayOutputStream getBinaryOutput() { return myBinaryOutput; } - @Nullable @Override - public Charset getCharset() { + public @Nullable Charset getCharset() { return myForceUtf8 ? StandardCharsets.UTF_8 : super.getCharset(); } - @NotNull @Override - protected BaseDataReader createOutputDataReader() { + protected @NotNull BaseDataReader createOutputDataReader() { if (myForceBinary) { return new SimpleBinaryOutputReader(myProcess.getInputStream(), readerOptions().policy()); } @@ -81,9 +78,8 @@ public class SvnProcessHandler extends OSProcessHandler { myBinaryOutput.write(data, 0, size); } - @NotNull @Override - protected Future executeOnPooledThread(@NotNull Runnable runnable) { + protected @NotNull Future executeOnPooledThread(@NotNull Runnable runnable) { return SvnProcessHandler.this.executeTask(runnable); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java index 7559812f61ee..bf01ccf26579 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalExecutor.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.CommandLineUtil; @@ -54,18 +40,16 @@ public class TerminalExecutor extends CommandExecutor { super.startHandlingStreams(); } - @NotNull @Override - protected SvnProcessHandler createProcessHandler() { + protected @NotNull SvnProcessHandler createProcessHandler() { return new TerminalProcessHandler(myProcess, myCommandLine, needsUtf8Output(), false); } /** * TODO: remove this when separate streams for output and errors are implemented for Unix. */ - @NotNull @Override - public ByteArrayOutputStream getBinaryOutput() { + public @NotNull ByteArrayOutputStream getBinaryOutput() { if (this instanceof WinTerminalExecutor) { return super.getBinaryOutput(); } @@ -78,27 +62,23 @@ public class TerminalExecutor extends CommandExecutor { return result; } - @NotNull @Override - protected GeneralCommandLine createCommandLine() { + protected @NotNull GeneralCommandLine createCommandLine() { return new PtyCommandLine(); } - @NotNull @Override - protected Process createProcess() throws ExecutionException { + protected @NotNull Process createProcess() throws ExecutionException { List parameters = escapeArguments(buildParameters()); return createProcess(parameters); } - @NotNull - protected List buildParameters() { + protected @NotNull List buildParameters() { return CommandLineUtil.toCommandLine(myCommandLine.getExePath(), myCommandLine.getParametersList().getList()); } - @NotNull - protected Process createProcess(@NotNull List parameters) throws ExecutionException { + protected @NotNull Process createProcess(@NotNull List parameters) throws ExecutionException { try { return ((PtyCommandLine)myCommandLine).withConsoleMode(false).startProcessWithPty(parameters); } @@ -114,8 +94,7 @@ public class TerminalExecutor extends CommandExecutor { LOG.info("Terminal output " + ((TerminalProcessHandler)myHandler).getTerminalOutput()); } - @NotNull - protected List escapeArguments(@NotNull List arguments) { + protected @NotNull List escapeArguments(@NotNull List arguments) { return arguments; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalProcessHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalProcessHandler.java index 324379965f08..e121aa40d6f8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalProcessHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalProcessHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.configurations.GeneralCommandLine; @@ -94,13 +80,11 @@ public class TerminalProcessHandler extends SvnProcessHandler { return result; } - @NotNull - protected String filterCombinedText(@NotNull String currentLine) { + protected @NotNull String filterCombinedText(@NotNull String currentLine) { return currentLine; } - @NotNull - protected String filterText(@NotNull String text) { + protected @NotNull String filterText(@NotNull String text) { return text; } @@ -116,8 +100,7 @@ public class TerminalProcessHandler extends SvnProcessHandler { } } - @NotNull - protected Key resolveOutputType(@NotNull String line, @NotNull Key outputType) { + protected @NotNull Key resolveOutputType(@NotNull String line, @NotNull Key outputType) { Key result = outputType; if (!ProcessOutputTypes.SYSTEM.equals(outputType)) { @@ -130,8 +113,7 @@ public class TerminalProcessHandler extends SvnProcessHandler { return result; } - @NotNull - private StringBuilder getLastLineFor(Key outputType) { + private @NotNull StringBuilder getLastLineFor(Key outputType) { if (ProcessOutputTypes.STDERR.equals(outputType)) { return errorLine; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java index 229fd9f497e1..fe1fb3342cfa 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java @@ -91,7 +91,7 @@ public class TerminalSshModule extends BaseTerminalModule { sendData(answer.get() == AcceptResult.REJECTED ? "no" : "yes"); } - private boolean handleAuthPrompt(@NotNull final SimpleCredentialsDialog.Mode mode, @NotNull final String key) { + private boolean handleAuthPrompt(final @NotNull SimpleCredentialsDialog.Mode mode, final @NotNull String key) { Url repositoryUrl = myExecutor.getCommand().requireRepositoryUrl(); String auth = myRuntime.getAuthenticationService().requestSshCredentials(repositoryUrl.toDecodedString(), mode, key); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSslCertificateModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSslCertificateModule.java index 3a00e5acaf38..fc832332d09d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSslCertificateModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSslCertificateModule.java @@ -1,4 +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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.Key; @@ -28,9 +28,9 @@ public class TerminalSslCertificateModule extends BaseTerminalModule { // if credentials caching is allowed private static final Pattern ACCEPT_CERTIFICATE_PROMPT = Pattern.compile("\\(R\\)eject.*\\?\\s?"); - @SuppressWarnings("MismatchedQueryAndUpdateOfStringBuilder") // TODO: display it - @NotNull private final StringBuilder certificateError = new StringBuilder(); - @NotNull private final StringBuilder certificateInfo = new StringBuilder(); + // TODO: display it + @SuppressWarnings("MismatchedQueryAndUpdateOfStringBuilder") private final @NotNull StringBuilder certificateError = new StringBuilder(); + private final @NotNull StringBuilder certificateInfo = new StringBuilder(); private boolean collectingCertificateError; private boolean collectingCertificateInfo; private String serverUrl; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java index e6ebf84546cd..8c9f1ac22870 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.text.StringUtil; @@ -17,44 +17,43 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public final class UpdateOutputLineConverter { - private final static @NonNls String MERGING = "--- Merging"; - private final static @NonNls String RECORDING_MERGE_INFO = "--- Recording mergeinfo"; + private static final @NonNls String MERGING = "--- Merging"; + private static final @NonNls String RECORDING_MERGE_INFO = "--- Recording mergeinfo"; - private final static @NonNls String UPDATING = "Updating"; - private final static @NonNls String SKIPPED = "Skipped"; - private final static @NonNls String RESTORED = "Restored"; + private static final @NonNls String UPDATING = "Updating"; + private static final @NonNls String SKIPPED = "Skipped"; + private static final @NonNls String RESTORED = "Restored"; - private final static @NonNls String FETCHING_EXTERNAL = "Fetching external"; + private static final @NonNls String FETCHING_EXTERNAL = "Fetching external"; - private final static Pattern ourAtRevision = Pattern.compile("At revision (\\d+)\\."); - private final static Pattern ourUpdatedToRevision = Pattern.compile("Updated to revision (\\d+)\\."); - private final static Pattern ourCheckedOutRevision = Pattern.compile("Checked out revision (\\d+)\\."); + private static final Pattern ourAtRevision = Pattern.compile("At revision (\\d+)\\."); + private static final Pattern ourUpdatedToRevision = Pattern.compile("Updated to revision (\\d+)\\."); + private static final Pattern ourCheckedOutRevision = Pattern.compile("Checked out revision (\\d+)\\."); // export from repository - private final static Pattern ourExportedRevision = Pattern.compile("Exported revision (\\d+)\\."); + private static final Pattern ourExportedRevision = Pattern.compile("Exported revision (\\d+)\\."); // export from working copy - private final static Pattern ourExportComplete = Pattern.compile("Export complete\\."); + private static final Pattern ourExportComplete = Pattern.compile("Export complete\\."); // update operation with no changes - still we're interested in revision number - private final static Pattern ourExternal = Pattern.compile("External at revision (\\d+)\\."); + private static final Pattern ourExternal = Pattern.compile("External at revision (\\d+)\\."); // update operation with some changes - private final static Pattern ourUpdatedExternal = Pattern.compile("Updated external to revision (\\d+)\\."); - private final static Pattern ourCheckedOutExternal = Pattern.compile("Checked out external at revision (\\d+)\\."); + private static final Pattern ourUpdatedExternal = Pattern.compile("Updated external to revision (\\d+)\\."); + private static final Pattern ourCheckedOutExternal = Pattern.compile("Checked out external at revision (\\d+)\\."); - private final static Pattern[] ourCompletePatterns = + private static final Pattern[] ourCompletePatterns = new Pattern[]{ourAtRevision, ourUpdatedToRevision, ourCheckedOutRevision, ourExportedRevision, ourExternal, ourUpdatedExternal, ourCheckedOutExternal, ourExportComplete}; private final File myBase; - @NotNull private final Stack myRootsUnderProcessing; + private final @NotNull Stack myRootsUnderProcessing; public UpdateOutputLineConverter(File base) { myBase = base; myRootsUnderProcessing = new Stack<>(); } - @Nullable - public ProgressEvent convert(final String line) { + public @Nullable ProgressEvent convert(final String line) { // TODO: Add direct processing of "Summary of conflicts" lines at the end of "svn update" output (if there are conflicts). // TODO: Now it works ok because parseNormalLine could not determine necessary statuses from that and further lines if (StringUtil.isEmptyOrSpaces(line)) return null; @@ -86,20 +85,17 @@ public final class UpdateOutputLineConverter { return parseNormalString(line); } - @NotNull - private static ProgressEvent createEvent(File file, @NotNull EventAction action) { + private static @NotNull ProgressEvent createEvent(File file, @NotNull EventAction action) { return createEvent(file, -1, action, null); } - @NotNull - private static ProgressEvent createEvent(File file, long revision, @NotNull EventAction action, @Nullable String error) { + private static @NotNull ProgressEvent createEvent(File file, long revision, @NotNull EventAction action, @Nullable String error) { return new ProgressEvent(file, revision, null, null, action, error, null); } - private final static Set ourActions = Set.of('A', 'D', 'U', 'C', 'G', 'E', 'R'); + private static final Set ourActions = Set.of('A', 'D', 'U', 'C', 'G', 'E', 'R'); - @Nullable - private ProgressEvent parseNormalString(final String line) { + private @Nullable ProgressEvent parseNormalString(final String line) { if (line.length() < 5) return null; final char first = line.charAt(0); if (' ' != first && ! ourActions.contains(first)) return null; @@ -155,15 +151,13 @@ public final class UpdateOutputLineConverter { return -1; } - @Nullable - private static String parseComment(final String line) { + private static @Nullable String parseComment(final String line) { int index = line.lastIndexOf("--"); return index != -1 && index < line.length() - 2 ? line.substring(index + 2).trim() : null; } - @Nullable - private File parseForPath(@NotNull String line) { + private @Nullable File parseForPath(@NotNull String line) { File result = null; int start = line.indexOf('\''); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java index 4ff5cc3566ed..6dee41cc89f4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalExecutor.java @@ -28,16 +28,15 @@ public class WinTerminalExecutor extends TerminalExecutor { } } - @Nullable private File myRedirectFile; - @Nullable private FileInputStream myRedirectStream; + private @Nullable File myRedirectFile; + private @Nullable FileInputStream myRedirectStream; public WinTerminalExecutor(@NotNull @NonNls String exePath, @NotNull Command command) { super(exePath, command); } - @NotNull @Override - protected SvnProcessHandler createProcessHandler() { + protected @NotNull SvnProcessHandler createProcessHandler() { return new WinTerminalProcessHandler(myProcess, myCommandLine, needsUtf8Output(), needsBinaryOutput()); } @@ -79,9 +78,8 @@ public class WinTerminalExecutor extends TerminalExecutor { deleteTempFile(myRedirectFile); } - @NotNull @Override - protected Process createProcess() throws ExecutionException { + protected @NotNull Process createProcess() throws ExecutionException { checkRedirectFile(); List parameters = escapeArguments(buildParameters()); @@ -118,14 +116,12 @@ public class WinTerminalExecutor extends TerminalExecutor { /** * TODO: Identify pty4j quoting requirements for Windows and implement accordingly */ - @NotNull @Override - protected List escapeArguments(@NotNull List arguments) { + protected @NotNull List escapeArguments(@NotNull List arguments) { return ContainerUtil.map(arguments, argument -> needQuote(argument) && !isQuoted(argument) ? quote(argument) : argument); } - @NotNull - private static String quote(@NotNull String argument) { + private static @NotNull String quote(@NotNull String argument) { return StringUtil.wrapWithDoubleQuote(argument); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java index 891e19b4e587..5380efbc3de3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java @@ -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 org.jetbrains.idea.svn.commandLine; import com.intellij.execution.configurations.GeneralCommandLine; @@ -24,16 +24,14 @@ public class WinTerminalProcessHandler extends TerminalProcessHandler { return true; } - @NotNull @Override - protected BaseDataReader createErrorDataReader() { + protected @NotNull BaseDataReader createErrorDataReader() { return new SimpleOutputReader(createProcessErrReader(), ProcessOutputTypes.STDERR, BaseOutputReader.Options.BLOCKING, "error stream of " + myPresentableName); } - @NotNull @Override - protected BaseOutputReader.Options readerOptions() { + protected @NotNull BaseOutputReader.Options readerOptions() { // Currently, when blocking policy is used, reading stops when nothing was actually read (stream ended). // This is an issue for reading output in Windows as redirection to file is used. And so file is actually // empty when first read attempt is performed (thus no output is read at all). @@ -41,9 +39,8 @@ public class WinTerminalProcessHandler extends TerminalProcessHandler { return BaseOutputReader.Options.NON_BLOCKING; } - @NotNull @Override - protected String filterCombinedText(@NotNull String currentLine) { + protected @NotNull String filterCombinedText(@NotNull String currentLine) { // for windows platform output is assumed in format suitable for terminal emulator // for instance, same text could be returned twice with '\r' symbol in between (so in emulator output we'll still see correct // text without duplication) @@ -51,9 +48,8 @@ public class WinTerminalProcessHandler extends TerminalProcessHandler { return removeAllBeforeCaretReturn(currentLine); } - @NotNull @Override - protected String filterText(@NotNull String text) { + protected @NotNull String filterText(@NotNull String text) { // filter terminal escape codes - they are presented in the output for windows platform text = text.replaceAll(CSI_ESCAPE_CODE, "").replaceAll(NON_CSI_ESCAPE_CODE, ""); // trim leading '\r' symbols - as they break xml parsing logic @@ -62,14 +58,12 @@ public class WinTerminalProcessHandler extends TerminalProcessHandler { return text; } - @NotNull @Override - protected Key resolveOutputType(@NotNull String line, @NotNull Key outputType) { + protected @NotNull Key resolveOutputType(@NotNull String line, @NotNull Key outputType) { return outputType; } - @NotNull - private static String removeAllBeforeCaretReturn(@NotNull String line) { + private static @NotNull String removeAllBeforeCaretReturn(@NotNull String line) { int caretReturn = line.lastIndexOf("\r"); while (caretReturn >= 0) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/AmbiguousPatternsFinder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/AmbiguousPatternsFinder.java index 3aa2c4ebdbb5..fb447f26dc74 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/AmbiguousPatternsFinder.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/AmbiguousPatternsFinder.java @@ -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 org.jetbrains.idea.svn.config; import com.intellij.openapi.util.NlsContexts.DialogMessage; @@ -13,7 +13,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class AmbiguousPatternsFinder { private final Map> urls2groups; - private final static int ourMessageLen = 30; + private static final int ourMessageLen = 30; public AmbiguousPatternsFinder() { urls2groups = new HashMap<>(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java index 162e13c2b768..7ecf7f7e2ded 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesComponent.java @@ -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 org.jetbrains.idea.svn.config; import com.intellij.openapi.actionSystem.*; @@ -40,8 +40,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent { } @Override - @NotNull - public JComponent createComponent() { + public @NotNull JComponent createComponent() { if (myComponent == null) { myComponent = super.createComponent(); } @@ -154,7 +153,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent { return false; })) { @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final TreePath path = myTree.getSelectionPath(); final MyNode node = (MyNode)path.getLastPathComponent(); final MyNode parentNode = (MyNode) node.getParent(); @@ -268,7 +267,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent { } private static class GroupNodesComparator implements Comparator { - private final static GroupNodesComparator instance = new GroupNodesComparator(); + private static final GroupNodesComparator instance = new GroupNodesComparator(); private static GroupNodesComparator getInstance() { return instance; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java index c189e39ef5b2..b7a9671e38f5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictAction.java @@ -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 org.jetbrains.idea.svn.conflict; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ public enum ConflictAction { @XmlEnumValue("delete") DELETE("delete", "deleted"), @XmlEnumValue("replace") REPLACE("replace", "replaced"); - @NotNull private static final Map ourAllActions = new HashMap<>(); + private static final @NotNull Map ourAllActions = new HashMap<>(); static { for (ConflictAction action : ConflictAction.values()) { @@ -22,7 +22,7 @@ public enum ConflictAction { } } - @NotNull private final String myKey; + private final @NotNull String myKey; private final String @NotNull [] myOtherKeys; ConflictAction(@NotNull String key, String @NotNull ... otherKeys) { @@ -43,8 +43,7 @@ public enum ConflictAction { } } - @NotNull - public static ConflictAction from(@NotNull String actionName) { + public static @NotNull ConflictAction from(@NotNull String actionName) { ConflictAction result = ourAllActions.get(actionName); if (result == null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java index d6b9c0798840..a1c653f4b16b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictOperation.java @@ -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 org.jetbrains.idea.svn.conflict; import com.intellij.openapi.util.text.StringUtil; @@ -13,14 +13,12 @@ public enum ConflictOperation { @XmlEnumValue("switch") SWITCH, @XmlEnumValue("merge") MERGE; - @NotNull - public static ConflictOperation from(@NotNull @NonNls String operationName) { + public static @NotNull ConflictOperation from(@NotNull @NonNls String operationName) { return valueOf(ConflictOperation.class, StringUtil.toUpperCase(operationName)); } @Override - @NonNls - public String toString() { + public @NonNls String toString() { return StringUtil.toLowerCase(super.toString()); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java index 4c084c16e8da..7273518ae301 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/conflict/ConflictReason.java @@ -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 org.jetbrains.idea.svn.conflict; import org.jetbrains.annotations.NotNull; @@ -22,7 +22,7 @@ public enum ConflictReason { @XmlEnumValue("moved-away") MOVED_AWAY("moved-away"), @XmlEnumValue("moved-here") MOVED_HERE("moved-here"); - @NotNull private static final Map ourAllReasons = new HashMap<>(); + private static final @NotNull Map ourAllReasons = new HashMap<>(); static { for (ConflictReason reason : ConflictReason.values()) { @@ -30,7 +30,7 @@ public enum ConflictReason { } } - @NotNull private final String myKey; + private final @NotNull String myKey; private final String @NotNull [] myOtherKeys; ConflictReason(@NotNull String key, String @NotNull ... otherKeys) { @@ -51,8 +51,7 @@ public enum ConflictReason { } } - @NotNull - public static ConflictReason from(@NotNull String reasonName) { + public static @NotNull ConflictReason from(@NotNull String reasonName) { ConflictReason result = ourAllReasons.get(reasonName); if (result == null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java index 6298778e23f5..3b06b4ea19e2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/copy/CmdCopyMoveClient.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.copy; import com.intellij.openapi.util.SystemInfo; @@ -106,8 +92,7 @@ public class CmdCopyMoveClient extends BaseSvnClient implements CopyMoveClient { listener.throwWrappedIfException(); } - @NotNull - private static SvnCommandName getCommandName(boolean isMove) { + private static @NotNull SvnCommandName getCommandName(boolean isMove) { return isMove ? SvnCommandName.move : SvnCommandName.copy; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java index c9f9ed6c1ff4..8dbc013c19ff 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/AddRepositoryLocationDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -27,8 +27,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnUtil.createUrl; public class AddRepositoryLocationDialog extends DialogWrapper { - @Unmodifiable - @NotNull private final List myPreviousLocations; + private final @Unmodifiable @NotNull List myPreviousLocations; private JComboBox myCombo; private Url mySelected; private JTextField myComboField; @@ -72,9 +71,8 @@ public class AddRepositoryLocationDialog extends DialogWrapper { return wrapper; } - @Nullable @Override - protected ValidationInfo doValidate() { + protected @Nullable ValidationInfo doValidate() { try { mySelected = createUrl(myComboField.getText().trim(), false); return null; @@ -89,8 +87,7 @@ public class AddRepositoryLocationDialog extends DialogWrapper { return new Action[]{getOKAction(), getCancelAction()}; } - @Nullable - public Url getSelected() { + public @Nullable Url getSelected() { return mySelected; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ByKeySelectedSearcher.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ByKeySelectedSearcher.java index 4e3fcffb9495..18c633586615 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ByKeySelectedSearcher.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ByKeySelectedSearcher.java @@ -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 org.jetbrains.idea.svn.dialogs; import org.jetbrains.annotations.Nullable; @@ -31,8 +17,7 @@ abstract class ByKeySelectedSearcher { protected abstract IterationResultHolder doChecks(final TreeNode node); - @Nullable - public TreeNode getNextSelectedByKey() { + public @Nullable TreeNode getNextSelectedByKey() { if (myKey != null) { for (final TreeNode node : myChildren) { final IterationResultHolder checkResult = doChecks(node); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java index 563b4c3d24d4..6be23e428f6c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ChangeFormatDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -26,9 +26,8 @@ public class ChangeFormatDialog extends UpgradeFormatDialog { init(); } - @Nullable @Override - protected JPanel getBottomAuxiliaryPanel() { + protected @Nullable JPanel getBottomAuxiliaryPanel() { if (! myWcRootIsAbove) { return null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java index d72a4f4a2424..2761ed255e83 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/CopiesPanel.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.configurationStore.StoreUtil; @@ -70,11 +70,11 @@ public class CopiesPanel extends SimpleToolWindowPanel { private static final @NonNls String HELP_ID = "reference.vcs.svn.working.copies.information"; - final static @NonNls String CHANGE_FORMAT = "CHANGE_FORMAT"; - final static @NonNls String CLEANUP = "CLEANUP"; - final static @NonNls String FIX_DEPTH = "FIX_DEPTH"; - final static @NonNls String CONFIGURE_BRANCHES = "CONFIGURE_BRANCHES"; - final static @NonNls String MERGE_FROM = "MERGE_FROM"; + static final @NonNls String CHANGE_FORMAT = "CHANGE_FORMAT"; + static final @NonNls String CLEANUP = "CLEANUP"; + static final @NonNls String FIX_DEPTH = "FIX_DEPTH"; + static final @NonNls String CONFIGURE_BRANCHES = "CONFIGURE_BRANCHES"; + static final @NonNls String MERGE_FROM = "MERGE_FROM"; public CopiesPanel(@NotNull Project project) { super(false, true); @@ -105,8 +105,7 @@ public class CopiesPanel extends SimpleToolWindowPanel { getVcs().invokeRefreshSvnRoots(); } - @NotNull - private SvnVcs getVcs() { + private @NotNull SvnVcs getVcs() { return SvnVcs.getInstance(myProject); } @@ -146,7 +145,7 @@ public class CopiesPanel extends SimpleToolWindowPanel { showErrorNotification(hasErrors); } - private void updateList(@NotNull final List infoList, @NotNull final List supportedFormats) { + private void updateList(final @NotNull List infoList, final @NotNull List supportedFormats) { myPanel.removeAll(); for (final WCInfo wcInfo : infoList) { @@ -174,8 +173,7 @@ public class CopiesPanel extends SimpleToolWindowPanel { myPanel.repaint(); } - @NotNull - private List getSupportedFormats() { + private @NotNull List getSupportedFormats() { List result = new ArrayList<>(); ClientFactory factory = getVcs().getFactory(); @@ -272,14 +270,13 @@ public class CopiesPanel extends SimpleToolWindowPanel { new CleanupWorker(getVcs(), singletonList(root)).execute(); } - @NotNull - private static Url getCorrespondingUrlInOtherBranch(@NotNull SvnBranchConfigurationNew configuration, - @NotNull Url url, - @NotNull Url otherBranchUrl) throws SvnBindException { + private static @NotNull Url getCorrespondingUrlInOtherBranch(@NotNull SvnBranchConfigurationNew configuration, + @NotNull Url url, + @NotNull Url otherBranchUrl) throws SvnBindException { return otherBranchUrl.appendPath(notNullize(configuration.getRelativeUrl(url)), false); } - private void changeFormat(@NotNull final WCInfo wcInfo, @NotNull final Collection supportedFormats) { + private void changeFormat(final @NotNull WCInfo wcInfo, final @NotNull Collection supportedFormats) { ChangeFormatDialog dialog = new ChangeFormatDialog(myProject, new File(wcInfo.getPath()), false, !wcInfo.isIsWcRoot()); dialog.setSupported(supportedFormats); @@ -319,7 +316,7 @@ public class CopiesPanel extends SimpleToolWindowPanel { } private static final class ErrorsFoundNotification extends Notification { - private ErrorsFoundNotification(@NotNull final Project project) { + private ErrorsFoundNotification(final @NotNull Project project) { super(NOTIFICATION_GROUP.getDisplayId(), "", message("subversion.roots.detection.errors.found.description"), NotificationType.ERROR); addAction( diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/IntersectingLocalChangesPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/IntersectingLocalChangesPanel.java index a091b1cf860d..e63f02b1d763 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/IntersectingLocalChangesPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/IntersectingLocalChangesPanel.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.ide.DataManager; @@ -36,9 +36,9 @@ import static com.intellij.util.ContentsUtil.addContent; import static org.jetbrains.idea.svn.SvnBundle.message; public final class IntersectingLocalChangesPanel { - @NotNull private final BorderLayoutPanel myPanel; - @NotNull private final List myFiles; - @NotNull private final Project myProject; + private final @NotNull BorderLayoutPanel myPanel; + private final @NotNull List myFiles; + private final @NotNull Project myProject; public IntersectingLocalChangesPanel(@NotNull Project project, @NotNull List files) { myProject = project; @@ -46,8 +46,7 @@ public final class IntersectingLocalChangesPanel { myPanel = createPanel(createLabel(), createTree()); } - @NotNull - private BorderLayoutPanel createPanel(@NotNull JLabel label, @NotNull JTree tree) { + private @NotNull BorderLayoutPanel createPanel(@NotNull JLabel label, @NotNull JTree tree) { BorderLayoutPanel panel = JBUI.Panels.simplePanel(); panel.setBackground(UIUtil.getTextFieldBackground()); @@ -72,8 +71,7 @@ public final class IntersectingLocalChangesPanel { return panel; } - @NotNull - private SimpleTree createTree() { + private @NotNull SimpleTree createTree() { SimpleTree tree = new SimpleTree(TreeModelBuilder.buildFromFilePaths(myProject, NoneChangesGroupingFactory.INSTANCE, myFiles)) { @Override protected void configureUiHelper(@NotNull TreeUIHelper helper) { @@ -89,8 +87,7 @@ public final class IntersectingLocalChangesPanel { return tree; } - @NotNull - private static JBLabel createLabel() { + private static @NotNull JBLabel createLabel() { JBLabel label = new JBLabel(message("label.merge.local.changes.intersection")) { @Override public Dimension getPreferredSize() { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java index 70779dc6d7f9..877d49114822 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/LockDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -19,7 +19,7 @@ public class LockDialog extends OptionsDialog { private JTextArea myLockTextArea; private JCheckBox myForceCheckBox; - @NonNls private static final String HELP_ID = "reference.VCS.subversion.lockFile"; + private static final @NonNls String HELP_ID = "reference.VCS.subversion.lockFile"; private final VcsShowSettingOption myOption; public LockDialog(Project project, boolean canBeParent, boolean multiple, @NonNls VcsShowSettingOption option) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java index ab3c47c58257..1cfb272058ff 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/PropertiesComponent.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.icons.AllIcons; @@ -45,7 +45,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnBundle.messagePointer; public class PropertiesComponent extends JPanel { - @NonNls public static final @NotNull String ID = "SVN Properties"; + public static final @NonNls @NotNull String ID = "SVN Properties"; private final @NotNull PropertiesTableView myTable = new PropertiesTableView(); private JTextArea myTextArea; @@ -146,8 +146,7 @@ public class PropertiesComponent extends JPanel { return group; } - @Nullable - private String getSelectedPropertyName() { + private @Nullable String getSelectedPropertyName() { PropertyData property = myTable.getSelectedObject(); return property != null ? property.getName() : null; } @@ -379,7 +378,7 @@ public class PropertiesComponent extends JPanel { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { super.update(e); // change file if (myIsFollowSelection) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RelocateDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RelocateDialog.java index a6f674848107..f3ad1f125f04 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RelocateDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RelocateDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -25,18 +25,15 @@ public class RelocateDialog extends DialogWrapper { } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myMainPanel; } - @NotNull - public String getBeforeURL() { + public @NotNull String getBeforeURL() { return myFromURLTextField.getText(); } - @NotNull - public String getAfterURL() { + public @NotNull String getAfterURL() { return myToURLTextField.getText(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java index 945399d04784..be76839eb890 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserComponent.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.Disposable; @@ -55,8 +55,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui return myRepositoryTree; } - @NotNull - public Project getProject() { + public @NotNull Project getProject() { return myVCS.getProject(); } @@ -106,7 +105,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui myRepositoryTree.setSelectionRow(0); } - public void expandNode(@NotNull final TreeNode treeNode) { + public void expandNode(final @NotNull TreeNode treeNode) { final TreeNode[] pathToNode = ((RepositoryTreeModel)myRepositoryTree.getModel()).getPathToRoot(treeNode); if ((pathToNode != null) && (pathToNode.length > 0)) { @@ -115,7 +114,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui } } - public Collection getExpandedSubTree(@NotNull final TreeNode treeNode) { + public Collection getExpandedSubTree(final @NotNull TreeNode treeNode) { final TreeNode[] pathToNode = ((RepositoryTreeModel)myRepositoryTree.getModel()).getPathToRoot(treeNode); final Enumeration expanded = myRepositoryTree.getExpandedDescendants(new TreePath(pathToNode)); @@ -130,7 +129,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui return result; } - public boolean isExpanded(@NotNull final TreeNode treeNode) { + public boolean isExpanded(final @NotNull TreeNode treeNode) { final TreeNode[] pathToNode = ((RepositoryTreeModel)myRepositoryTree.getModel()).getPathToRoot(treeNode); return (pathToNode != null) && (pathToNode.length > 0) && myRepositoryTree.isExpanded(new TreePath(pathToNode)); @@ -144,8 +143,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui ((RepositoryTreeModel)myRepositoryTree.getModel()).removeRoot(url); } - @Nullable - public DirectoryEntry getSelectedEntry() { + public @Nullable DirectoryEntry getSelectedEntry() { TreePath selection = myRepositoryTree.getSelectionPath(); if (selection == null) { return null; @@ -157,14 +155,12 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui return null; } - @Nullable - public String getSelectedURL() { + public @Nullable String getSelectedURL() { Url selectedUrl = getSelectedSVNURL(); return selectedUrl == null ? null : selectedUrl.toString(); } - @Nullable - public Url getSelectedSVNURL() { + public @Nullable Url getSelectedSVNURL() { TreePath selection = myRepositoryTree.getSelectionPath(); if (selection == null) { return null; @@ -210,8 +206,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui EditSourceOnDoubleClickHandler.install(myRepositoryTree); } - @Nullable - public RepositoryTreeNode getSelectedNode() { + public @Nullable RepositoryTreeNode getSelectedNode() { TreePath selection = myRepositoryTree.getSelectionPath(); if (selection != null && selection.getLastPathComponent() instanceof RepositoryTreeNode) { return (RepositoryTreeNode)selection.getLastPathComponent(); @@ -219,13 +214,12 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui return null; } - public void setSelectedNode(@NotNull final TreeNode node) { + public void setSelectedNode(final @NotNull TreeNode node) { final TreeNode[] pathNodes = ((RepositoryTreeModel)myRepositoryTree.getModel()).getPathToRoot(node); myRepositoryTree.setSelectionPath(new TreePath(pathNodes)); } - @Nullable - public VirtualFile getSelectedVcsFile() { + public @Nullable VirtualFile getSelectedVcsFile() { final RepositoryTreeNode node = getSelectedNode(); if (node == null) return null; @@ -278,8 +272,7 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Ui ((RepositoryTreeModel)myRepositoryTree.getModel()).setDefaultExpanderFactory(expanderFactory); } - @NotNull - public StatusText getStatusText() { + public @NotNull StatusText getStatusText() { return myRepositoryTree.getEmptyText(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java index f8965c7ba8e6..792f5e027f40 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.CommonBundle; @@ -82,7 +82,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { private final Project myProject; protected final SvnVcs myVCS; - @NotNull private final RepositoryBrowserComponent myRepositoryBrowser; + private final @NotNull RepositoryBrowserComponent myRepositoryBrowser; private final DeleteAction myDeleteAction; private AnAction copyUrlAction; @@ -90,8 +90,8 @@ public class RepositoryBrowserDialog extends DialogWrapper { private final boolean myShowFiles; - @NonNls public static final String PLACE_TOOLBAR = "RepositoryBrowser.Toolbar"; - @NonNls private static final String PLACE_MENU = "RepositoryBrowser.Menu"; + public static final @NonNls String PLACE_TOOLBAR = "RepositoryBrowser.Toolbar"; + private static final @NonNls String PLACE_MENU = "RepositoryBrowser.Menu"; private final @NlsContexts.Label String myRepositoriesLabelText; protected JLabel myRepositoriesLabel; @@ -277,8 +277,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { return panel; } - @NotNull - protected RepositoryBrowserComponent getRepositoryBrowser() { + protected @NotNull RepositoryBrowserComponent getRepositoryBrowser() { return myRepositoryBrowser; } @@ -311,8 +310,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { return getRepositoryBrowser().getSelectedURL(); } - @Nullable - protected RepositoryTreeNode getSelectedNode() { + protected @Nullable RepositoryTreeNode getSelectedNode() { return getRepositoryBrowser().getSelectedNode(); } @@ -429,7 +427,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { protected static class EditLocationAction extends DumbAwareAction { - @NotNull private final RepositoryBrowserComponent myBrowserComponent; + private final @NotNull RepositoryBrowserComponent myBrowserComponent; public EditLocationAction(@NotNull RepositoryBrowserComponent browserComponent) { super(messagePointer("repository.browser.edit.location.menu.item")); @@ -662,7 +660,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final RepositoryTreeNode node = getSelectedNode(); if (node == null) { return; @@ -787,8 +785,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { public void doSynthetic() { } @Override - @Nullable - public Url parent() { + public @Nullable Url parent() { return null; } }; @@ -811,7 +808,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final RepositoryTreeNode treeNode = getRepositoryBrowser().getSelectedNode(); if (treeNode != null) { final String url = treeNode.getURL().toString(); @@ -1029,7 +1026,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(getRepositoryBrowser().getSelectedNode() != null); } } @@ -1064,8 +1061,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { } } - @Nullable - private File selectFile(@DialogTitle String title, @Label String description) { + private @Nullable File selectFile(@DialogTitle String title, @Label String description) { FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor(); fcd.setShowFileSystemRoots(true); fcd.setTitle(title); @@ -1130,7 +1126,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { } } - protected void doCheckout(@Nullable final CheckoutProvider.Listener listener, final RepositoryTreeNode selectedNode) { + protected void doCheckout(final @Nullable CheckoutProvider.Listener listener, final RepositoryTreeNode selectedNode) { if (selectedNode == null) { return; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeModel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeModel.java index 2309436d4a94..18de574047b1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeModel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeModel.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.Disposable; @@ -109,13 +109,11 @@ public class RepositoryTreeModel extends DefaultTreeModel implements Disposable return myCacheLoader; } - @NotNull - public Expander getLazyLoadingExpander() { + public @NotNull Expander getLazyLoadingExpander() { return myDefaultExpanderFactory.fun(myBrowser); } - @NotNull - public Expander getSelectionKeepingExpander() { + public @NotNull Expander getSelectionKeepingExpander() { return new KeepingSelectionExpander(myBrowser); } @@ -123,8 +121,7 @@ public class RepositoryTreeModel extends DefaultTreeModel implements Disposable myDefaultExpanderFactory = defaultExpanderFactory; } - @Nullable - public RepositoryTreeNode findByUrl(final RepositoryTreeNode oldNode) { + public @Nullable RepositoryTreeNode findByUrl(final RepositoryTreeNode oldNode) { if (oldNode.getParent() == null) { return oldNode; } @@ -165,8 +162,7 @@ public class RepositoryTreeModel extends DefaultTreeModel implements Disposable return (RepositoryTreeNode) root; } - @Nullable - private static RepositoryTreeNode getChild(final RepositoryTreeNode node, final Url url) { + private static @Nullable RepositoryTreeNode getChild(final RepositoryTreeNode node, final Url url) { final List children = node.getAlreadyLoadedChildren(); for (RepositoryTreeNode child : children) { if (child.getURL().equals(url)) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java index c441f8e0df05..c3ecb018d331 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryTreeNode.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.CommonBundle; @@ -24,12 +24,12 @@ import java.util.List; public class RepositoryTreeNode implements TreeNode, Disposable { private TreeNode myParentNode; - @NotNull private final List myChildren; + private final @NotNull List myChildren; private final RepositoryTreeModel myModel; private final Url myURL; private final Object myUserObject; - @NotNull private final NodeLoadState myLoadState; + private final @NotNull NodeLoadState myLoadState; private NodeLoadState myChildrenLoadState; public RepositoryTreeNode(RepositoryTreeModel model, TreeNode parentNode, @@ -94,8 +94,7 @@ public class RepositoryTreeNode implements TreeNode, Disposable { reload(removeCurrentChildren ? myModel.getSelectionKeepingExpander() : myModel.getLazyLoadingExpander(), removeCurrentChildren); } - @Nullable - public TreeNode getNextChildByKey(final String key, final boolean isFolder) { + public @Nullable TreeNode getNextChildByKey(final String key, final boolean isFolder) { final ByKeySelectedSearcher searcher = (isFolder) ? new FolderByKeySelectedSearcher(key, myChildren) : new FileByKeySelectedSearcher(key, myChildren); return searcher.getNextSelectedByKey(); @@ -139,8 +138,7 @@ public class RepositoryTreeNode implements TreeNode, Disposable { return myURL; } - @Nullable - public DirectoryEntry getSVNDirEntry() { + public @Nullable DirectoryEntry getSVNDirEntry() { return myUserObject instanceof DirectoryEntry ? (DirectoryEntry)myUserObject : null; } @@ -156,13 +154,11 @@ public class RepositoryTreeNode implements TreeNode, Disposable { return ! (myUserObject instanceof DirectoryEntry); } - @NotNull - public List getAllAlreadyLoadedChildren() { + public @NotNull List getAllAlreadyLoadedChildren() { return new ArrayList<>(myChildren); } - @NotNull - public List getAlreadyLoadedChildren() { + public @NotNull List getAlreadyLoadedChildren() { return ContainerUtil.filterIsInstance(myChildren, RepositoryTreeNode.class); } @@ -223,8 +219,7 @@ public class RepositoryTreeNode implements TreeNode, Disposable { return NodeLoadState.CACHED.equals(myLoadState); } - @Nullable - public RepositoryTreeNode getNodeWithSamePathUnderModelRoot() { + public @Nullable RepositoryTreeNode getNodeWithSamePathUnderModelRoot() { return myModel.findByUrl(this); } @@ -238,8 +233,8 @@ public class RepositoryTreeNode implements TreeNode, Disposable { private static final class SubTreeWalker { - @NotNull private final RepositoryTreeNode myNode; - @NotNull private final NotNullFunction myFunction; + private final @NotNull RepositoryTreeNode myNode; + private final @NotNull NotNullFunction myFunction; private SubTreeWalker(@NotNull RepositoryTreeNode node, @NotNull NotNullFunction function) { myNode = node; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java index e220000747ac..873bd0057b58 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.actionSystem.ActionManager; @@ -47,34 +47,30 @@ public final class SelectLocationDialog extends DialogWrapper { private static final @NonNls String HELP_ID = "vcs.subversion.common"; // todo check that works when authenticated - @Nullable - public static Url selectLocation(Project project, @NotNull Url url) { + public static @Nullable Url selectLocation(Project project, @NotNull Url url) { SelectLocationDialog dialog = openDialog(project, url, null, null, true, null); return dialog == null || !dialog.isOK() ? null : dialog.getSelectedURL(); } - @Nullable - public static Pair selectLocationAndRoot(Project project, @NotNull Url url) { + public static @Nullable Pair selectLocationAndRoot(Project project, @NotNull Url url) { SelectLocationDialog dialog = new SelectLocationDialog(project, url, null, null, true, true); return dialog.showAndGet() ? create(dialog.getSelectedURL(), dialog.getRootUrl()) : null; } - @Nullable - public static Url selectCopyDestination(@NotNull Project project, @NotNull Url url, @NotNull String dstName) throws SvnBindException { + public static @Nullable Url selectCopyDestination(@NotNull Project project, @NotNull Url url, @NotNull String dstName) throws SvnBindException { SelectLocationDialog dialog = openDialog(project, url, message("label.copy.select.location.dialog.copy.as"), dstName, false, message("select.location.invalid.url.message", url)); return dialog == null || !dialog.isOK() ? null : append(Objects.requireNonNull(dialog.getSelectedURL()), dialog.getDestinationName()); } - @Nullable - private static SelectLocationDialog openDialog(Project project, - @NotNull Url url, - @NlsContexts.Label @Nullable String dstLabel, - String dstName, - boolean showFiles, - @NlsContexts.DialogMessage @Nullable String errorMessage) { + private static @Nullable SelectLocationDialog openDialog(Project project, + @NotNull Url url, + @NlsContexts.Label @Nullable String dstLabel, + String dstName, + boolean showFiles, + @NlsContexts.DialogMessage @Nullable String errorMessage) { try { final Url repositoryUrl = initRoot(project, url); if (repositoryUrl == null) { @@ -120,8 +116,7 @@ public final class SelectLocationDialog extends DialogWrapper { return "svn.repositoryBrowser"; } - @Nullable - private static Url initRoot(final Project project, final Url url) throws SvnBindException { + private static @Nullable Url initRoot(final Project project, final Url url) throws SvnBindException { final Ref result = new Ref<>(); final Ref excRef = new Ref<>(); @@ -233,8 +228,7 @@ public final class SelectLocationDialog extends DialogWrapper { return panel; } - @NotNull - private JComponent createToolbar() { + private @NotNull JComponent createToolbar() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new RepositoryBrowserDialog.EditLocationAction(myRepositoryBrowser)); @@ -260,18 +254,15 @@ public final class SelectLocationDialog extends DialogWrapper { return ok; } - @NotNull - public String getDestinationName() { + public @NotNull String getDestinationName() { return myDstText.getText().trim(); } - @Nullable - public Url getSelectedURL() { + public @Nullable Url getSelectedURL() { return myRepositoryBrowser.getSelectedSVNURL(); } - @Nullable - public Url getRootUrl() { + public @Nullable Url getRootUrl() { RepositoryTreeNode node = myRepositoryBrowser.getSelectedNode(); // find the most top parent of type RepositoryTreeNode diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java index 980e87b3bd13..b79feed60249 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSHDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -24,8 +24,8 @@ public class ServerSSHDialog extends DialogWrapper { public ServerSSHDialog(Project project, boolean store, - @NotNull final String host, - @Nullable final String algorithm, + final @NotNull String host, + final @Nullable String algorithm, @NlsSafe @NotNull String fingerprints) { super(project, true); myStore = store; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java index 9c81117d91c7..7c1d2688bd17 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ServerSSLDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -17,7 +17,7 @@ import java.security.cert.X509Certificate; public class ServerSSLDialog extends DialogWrapper { - @NotNull private final String myCertificateInfo; + private final @NotNull String myCertificateInfo; private Action myTempAction; private AcceptResult myResult; @@ -94,8 +94,7 @@ public class ServerSSLDialog extends DialogWrapper { } @SuppressWarnings({"HardCodedStringLiteral", "StringBufferReplaceableByString"}) - @NotNull - private static String getServerCertificateInfo(@NotNull X509Certificate cert) { + private static @NotNull String getServerCertificateInfo(@NotNull X509Certificate cert) { return new StringBuilder() .append(" - Subject: ") .append(cert.getSubjectDN().getName()) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java index d33108797a89..913dff691e1b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetKeywordsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -14,8 +14,8 @@ import org.jetbrains.idea.svn.properties.PropertyValue; import javax.swing.*; import java.awt.*; -import java.util.List; import java.util.*; +import java.util.List; import static org.jetbrains.idea.svn.SvnBundle.message; @@ -29,8 +29,8 @@ public class SetKeywordsDialog extends DialogWrapper { "Rev", "LastChangedRevision", "Author", "LastChangedBy"); - @Nullable private final PropertyValue myKeywordsValue; - @NotNull private final List myKeywordOptions; + private final @Nullable PropertyValue myKeywordsValue; + private final @NotNull List myKeywordOptions; protected SetKeywordsDialog(Project project, @Nullable PropertyValue keywordsValue) { super(project, false); @@ -42,16 +42,14 @@ public class SetKeywordsDialog extends DialogWrapper { init(); } - @Nullable - public String getKeywords() { + public @Nullable String getKeywords() { List selectedKeywords = ContainerUtil.filter(myKeywordOptions, keywordOption -> keywordOption.isSelected()); return StringUtil.nullize(StringUtil.join(selectedKeywords, keywordOption -> keywordOption.getText(), " ")); } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); panel.add(new JBLabel(message("label.select.keywords.to.set")), BorderLayout.NORTH); JPanel buttonsPanel = new JPanel(new GridLayout(5, 1)); @@ -87,8 +85,7 @@ public class SetKeywordsDialog extends DialogWrapper { * TODO: Subversion 1.8 also allow defining custom keywords (in "svn:keywords" property value). But currently it is unnecessary for this * TODO: dialog. */ - @NotNull - private static Set parseKeywords(@Nullable PropertyValue keywordsValue) { + private static @NotNull Set parseKeywords(@Nullable PropertyValue keywordsValue) { Set result = new HashSet<>(); if (keywordsValue != null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java index 6359975a1507..6d390700c2cc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SetPropertyDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.diagnostic.Logger; @@ -15,7 +15,6 @@ import org.jetbrains.idea.svn.SvnVcs; import org.jetbrains.idea.svn.api.Depth; import org.jetbrains.idea.svn.api.Revision; import org.jetbrains.idea.svn.api.Target; -import org.jetbrains.idea.svn.api.Url; import org.jetbrains.idea.svn.commandLine.SvnBindException; import org.jetbrains.idea.svn.properties.PropertyClient; import org.jetbrains.idea.svn.properties.PropertyConsumer; @@ -48,7 +47,7 @@ public class SetPropertyDialog extends DialogWrapper { private final boolean myIsRecursionAllowed; private final SvnVcs myVCS; - @NonNls private static final String HELP_ID = "vcs.subversion.property"; + private static final @NonNls String HELP_ID = "vcs.subversion.property"; private JPanel myMainPanel; public SetPropertyDialog(Project project, File[] files, @NlsSafe @Nullable String name, boolean allowRecursion) { @@ -145,8 +144,7 @@ public class SetPropertyDialog extends DialogWrapper { } } - @Nullable - private PropertyValue getProperty(@NotNull File file, @NotNull String name) { + private @Nullable PropertyValue getProperty(@NotNull File file, @NotNull String name) { PropertyValue result; try { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java index 0cb311e206a4..8312b5490ffa 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/ShareDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.idea.ActionsBundle; @@ -160,8 +160,7 @@ public class ShareDialog extends RepositoryBrowserDialog { return wrapper; } - @NotNull - public ShareTarget getShareTarget() { + public @NotNull ShareTarget getShareTarget() { if (myExisting.isSelected()) { return ShareTarget.useSelected; } @@ -175,8 +174,7 @@ public class ShareDialog extends RepositoryBrowserDialog { return myCreateStandard.isSelected(); } - @NotNull - public String getCommitText() { + public @NotNull String getCommitText() { return myCommitMessage.getComment(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java index 9a4e8947be76..ddb41094cf87 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SimpleCredentialsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.project.Project; @@ -26,7 +26,7 @@ public class SimpleCredentialsDialog extends DialogWrapper implements DocumentLi private JCheckBox myAllowSaveCheckBox; private JPasswordField myPasswordText; - @NonNls private static final String HELP_ID = "vcs.subversion.authentication"; + private static final @NonNls String HELP_ID = "vcs.subversion.authentication"; public SimpleCredentialsDialog(Project project) { super(project, true); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SshSettingsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SshSettingsPanel.java index 3e684b8f101e..5793ea551a57 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SshSettingsPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SshSettingsPanel.java @@ -139,9 +139,8 @@ public class SshSettingsPanel implements ConfigurableUi, Dispo state.sshPrivateKeyPath = myPrivateKeyPathField.getText(); } - @NotNull @Override - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return myMainPanel; } @@ -155,8 +154,7 @@ public class SshSettingsPanel implements ConfigurableUi, Dispo setSelected(mySubversionConfigChoice, value); } - @NotNull - private SvnConfiguration.SshConnectionType getConnectionChoice() { + private @NotNull SvnConfiguration.SshConnectionType getConnectionChoice() { JBRadioButton selected = myPasswordChoice.isSelected() ? myPasswordChoice : myPrivateKeyChoice.isSelected() diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java index 5e55755d9647..87ac1ba71ae0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.progress.ProcessCanceledException; @@ -31,12 +31,12 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnFormatWorker extends Task.Backgroundable { private final List myExceptions; - @NotNull private final WorkingCopyFormat myNewFormat; + private final @NotNull WorkingCopyFormat myNewFormat; private final List myWcInfos; private List myBeforeChangeLists; private final SvnVcs myVcs; - public SvnFormatWorker(final Project project, @NotNull final WorkingCopyFormat newFormat, final List wcInfos) { + public SvnFormatWorker(final Project project, final @NotNull WorkingCopyFormat newFormat, final List wcInfos) { super(project, message("progress.title.convert.working.copy.format"), false, DEAF); myNewFormat = newFormat; myExceptions = new ArrayList<>(); @@ -44,7 +44,7 @@ public class SvnFormatWorker extends Task.Backgroundable { myVcs = SvnVcs.getInstance(myProject); } - public SvnFormatWorker(final Project project, @NotNull final WorkingCopyFormat newFormat, final WCInfo wcInfo) { + public SvnFormatWorker(final Project project, final @NotNull WorkingCopyFormat newFormat, final WCInfo wcInfo) { this(project, newFormat, Collections.singletonList(wcInfo)); } @@ -74,7 +74,7 @@ public class SvnFormatWorker extends Task.Backgroundable { } @Override - public void run(@NotNull final ProgressIndicator indicator) { + public void run(final @NotNull ProgressIndicator indicator) { ProjectLevelVcsManager.getInstance(myProject).startBackgroundVcsOperation(); indicator.setIndeterminate(true); final boolean supportsChangelists = myNewFormat.supportsChangelists(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java index ed73ccec49b0..2f43054b0135 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/UpgradeFormatDialog.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.application.ApplicationNamesInfo; @@ -56,12 +56,11 @@ public class UpgradeFormatDialog extends DialogWrapper { } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn.upgradeDialog"; } - public void setData(@NotNull final WorkingCopyFormat selectedFormat) { + public void setData(final @NotNull WorkingCopyFormat selectedFormat) { for (JRadioButton button : formatButtons) { if (selectedFormat == getFormat(button)) { button.setSelected(true); @@ -109,8 +108,7 @@ public class UpgradeFormatDialog extends DialogWrapper { } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); @@ -160,8 +158,7 @@ public class UpgradeFormatDialog extends DialogWrapper { formatButtons.add(button); } - @Nullable - protected JPanel getBottomAuxiliaryPanel() { + protected @Nullable JPanel getBottomAuxiliaryPanel() { return null; } @@ -169,15 +166,13 @@ public class UpgradeFormatDialog extends DialogWrapper { return true; } - @NotNull - private static WorkingCopyFormat getFormat(@NotNull JRadioButton button) { + private static @NotNull WorkingCopyFormat getFormat(@NotNull JRadioButton button) { Object format = button.getClientProperty("format"); return format instanceof WorkingCopyFormat ? (WorkingCopyFormat)format : WorkingCopyFormat.UNKNOWN; } - @NotNull - public WorkingCopyFormat getUpgradeMode() { + public @NotNull WorkingCopyFormat getUpgradeMode() { WorkingCopyFormat result = WorkingCopyFormat.UNKNOWN; for (JRadioButton button : formatButtons) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java index 21fb5757084f..c28f62059fe0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfo.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.util.NlsSafe; @@ -16,8 +16,8 @@ import org.jetbrains.idea.svn.commandLine.SvnBindException; public class WCInfo { private final boolean myIsWcRoot; - @NotNull private final Depth myStickyDepth; - @NotNull private final RootUrlInfo myRootInfo; + private final @NotNull Depth myStickyDepth; + private final @NotNull RootUrlInfo myRootInfo; public WCInfo(@NotNull RootUrlInfo rootInfo, boolean isWcRoot, @NotNull Depth stickyDepth) { myRootInfo = rootInfo; @@ -25,8 +25,7 @@ public class WCInfo { myStickyDepth = stickyDepth; } - @NotNull - public Depth getStickyDepth() { + public @NotNull Depth getStickyDepth() { return myStickyDepth; } @@ -34,23 +33,19 @@ public class WCInfo { return myRootInfo.getPath(); } - @Nullable - public VirtualFile getVcsRoot() { + public @Nullable VirtualFile getVcsRoot() { return null; } - @NotNull - public Url getUrl() { + public @NotNull Url getUrl() { return myRootInfo.getUrl(); } - @NotNull - public Url getRepoUrl() { + public @NotNull Url getRepoUrl() { return myRootInfo.getRepositoryUrl(); } - @NotNull - public RootUrlInfo getRootInfo() { + public @NotNull RootUrlInfo getRootInfo() { return myRootInfo; } @@ -64,8 +59,7 @@ public class WCInfo { return error != null ? error.getMessage() : ""; } - @NotNull - public WorkingCopyFormat getFormat() { + public @NotNull WorkingCopyFormat getFormat() { return myRootInfo.getFormat(); } @@ -86,8 +80,7 @@ public class WCInfo { return getPath().hashCode(); } - @Nullable - public NestedCopyType getType() { + public @Nullable NestedCopyType getType() { return myRootInfo.getType(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfoWithBranches.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfoWithBranches.java index 710a838c4f65..7d24d5236613 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfoWithBranches.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/WCInfoWithBranches.java @@ -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 org.jetbrains.idea.svn.dialogs; import com.intellij.openapi.vfs.VirtualFile; @@ -9,8 +9,8 @@ import java.util.List; public class WCInfoWithBranches extends WCInfo { - @NotNull private final List myBranches; - @NotNull private final VirtualFile myRoot; + private final @NotNull List myBranches; + private final @NotNull VirtualFile myRoot; private final Branch myCurrentBranch; public WCInfoWithBranches(@NotNull WCInfo info, @NotNull List branches, @NotNull VirtualFile root, Branch currentBranch) { @@ -28,21 +28,18 @@ public class WCInfoWithBranches extends WCInfo { } @Override - @NotNull - public VirtualFile getVcsRoot() { + public @NotNull VirtualFile getVcsRoot() { return myRoot; } /** * List of all branches according to branch configuration. Does not contain {@code getCurrentBranch()} branch. */ - @NotNull - public List getBranches() { + public @NotNull List getBranches() { return myBranches; } - @NotNull - public VirtualFile getRoot() { + public @NotNull VirtualFile getRoot() { return myRoot; } @@ -54,19 +51,17 @@ public class WCInfoWithBranches extends WCInfo { } public static class Branch { - @NotNull private final Url myUrl; + private final @NotNull Url myUrl; public Branch(@NotNull Url url) { myUrl = url; } - @NotNull - public String getName() { + public @NotNull String getName() { return myUrl.getTail(); } - @NotNull - public Url getUrl() { + public @NotNull Url getUrl() { return myUrl; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/AbstractOpeningExpander.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/AbstractOpeningExpander.java index 6c71194822c4..166a54d8cacc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/AbstractOpeningExpander.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/AbstractOpeningExpander.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ import java.util.Enumeration; public abstract class AbstractOpeningExpander implements Expander { private final RepositoryBrowserComponent myBrowser; private final KeepingExpandedExpander myKeepingExpander; - @NotNull private final Url mySelectionPath; + private final @NotNull Url mySelectionPath; protected AbstractOpeningExpander(final RepositoryBrowserComponent browser, @NotNull Url selectionPath) { myBrowser = browser; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java index b88202f5c898..f371c24618b8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.fileChooser.FileChooser; @@ -109,13 +109,11 @@ public class CheckoutOptionsDialog extends DialogWrapper { } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.checkout.options"; } - @Nullable - public File getTarget() { + public @Nullable File getTarget() { Object[] objects = myLocalTargetList.getSelectedValues(); return (objects == null) || (objects.length != 1) ? null : (File) objects[0]; } @@ -129,13 +127,11 @@ public class CheckoutOptionsDialog extends DialogWrapper { } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myTopPanel; } - @NotNull - public Revision getRevision() throws ConfigurationException { + public @NotNull Revision getRevision() throws ConfigurationException { return svnSelectRevisionPanel.getRevision(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CopyOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CopyOptionsDialog.java index e19606f3995c..f8edf5ce7870 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CopyOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CopyOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -97,10 +97,9 @@ public class CopyOptionsDialog extends DialogWrapper { update(); } - @NotNull - public static ComboBox configureRecentMessagesComponent(@NotNull Project project, - @NotNull ComboBox comboBox, - @NotNull Consumer messageConsumer) { + public static @NotNull ComboBox configureRecentMessagesComponent(@NotNull Project project, + @NotNull ComboBox comboBox, + @NotNull Consumer messageConsumer) { List messages = VcsConfiguration.getInstance(project).getRecentMessages(); Collections.reverse(messages); CollectionComboBoxModel model = new CollectionComboBoxModel<>(messages); @@ -112,8 +111,7 @@ public class CopyOptionsDialog extends DialogWrapper { return comboBox; } - @NlsSafe - private static String getPresentableCommitMessage(@NotNull String commitMessage) { + private static @NlsSafe String getPresentableCommitMessage(@NotNull String commitMessage) { return commitMessage.replace('\r', '|').replace('\n', '|'); } @@ -152,16 +150,14 @@ public class CopyOptionsDialog extends DialogWrapper { ); } - @NotNull - private JPanel createCommitMessageWrapper() { + private @NotNull JPanel createCommitMessageWrapper() { myCommitMessage = new CommitMessage(myProject, false, false, true); Disposer.register(getDisposable(), myCommitMessage); return simplePanel(myCommitMessage).addToTop(new JBLabel(message("label.commit.message"))); } - @NotNull - private JPanel createBrowserPartWrapper() { + private @NotNull JPanel createBrowserPartWrapper() { JPanel wrapper = new JPanel(new GridBagLayout()); GridBag gridBag = new GridBag().setDefaultAnchor(GridBagConstraints.NORTHWEST).setDefaultFill(GridBagConstraints.NONE).setDefaultInsets(insets(1)) @@ -199,8 +195,7 @@ public class CopyOptionsDialog extends DialogWrapper { } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.copy.options"; } @@ -216,19 +211,16 @@ public class CopyOptionsDialog extends DialogWrapper { return myNameField.getText(); } - @Nullable - public Url getTargetURL() { + public @Nullable Url getTargetURL() { return myTargetUrl; } - @Nullable - public RepositoryTreeNode getTargetParentNode() { + public @Nullable RepositoryTreeNode getTargetParentNode() { return myBrowser.getSelectedNode(); } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myMainPanel; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java index 8bd37ee46c72..c7bae7374c33 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.project.Project; @@ -30,8 +30,7 @@ public class DeleteOptionsDialog extends DialogWrapper { } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.delete.options"; } @@ -40,8 +39,7 @@ public class DeleteOptionsDialog extends DialogWrapper { } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java index 1c25ec8c1616..ad9bf0d6b6e7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; @@ -42,7 +42,7 @@ public class DiffOptionsDialog extends DialogWrapper implements ActionListener { private JLabel mySourceUrlLabel; private JPanel myMainPanel; private JLabel myErrorLabel; - @NonNls private static final String DEFAULT_PATCH_NAME = "diff.txt"; + private static final @NonNls String DEFAULT_PATCH_NAME = "diff.txt"; public DiffOptionsDialog(Project project, Url rootURL, Url url) { super(project, true); @@ -67,7 +67,7 @@ public class DiffOptionsDialog extends DialogWrapper implements ActionListener { }); myFileBrowser.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { update(); } }); @@ -80,8 +80,7 @@ public class DiffOptionsDialog extends DialogWrapper implements ActionListener { } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.diff.options"; } @@ -146,8 +145,7 @@ public class DiffOptionsDialog extends DialogWrapper implements ActionListener { return myBrowser; } - @Nullable - private File selectFile() { + private @Nullable File selectFile() { FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor(); fcd.setShowFileSystemRoots(true); fcd.setTitle(message("dialog.title.save.unified.diff")); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java index 678395618f35..9527a014a436 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.application.ApplicationBundle; @@ -54,8 +54,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.export.options"; } @@ -75,15 +74,13 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener return !myExternalsCheckbox.isSelected(); } - @Nullable - public String getEOLStyle() { + public @Nullable String getEOLStyle() { LineSeparator separator = myLineSeparatorComboBoxModel.getSelected(); return separator != null ? separator.name() : null; } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); @@ -163,8 +160,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener return panel; } - @NotNull - private ComboBox createLineSeparatorComboBox() { + private @NotNull ComboBox createLineSeparatorComboBox() { ComboBox comboBox = new ComboBox<>(myLineSeparatorComboBoxModel); comboBox.setRenderer(SimpleListCellRenderer.create(message("combobox.crlf.none"), separator -> diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java index 1e3c5576538a..09e815713848 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.fileChooser.FileChooser; @@ -49,8 +49,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.import.options"; } @@ -71,8 +70,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java index 94ee2ca269d2..c163af35c2ea 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.openapi.project.Project; @@ -31,7 +31,7 @@ public class MkdirOptionsDialog extends DialogWrapper { private ComboBox myMessagesBox; private JPanel myMainPanel; private JLabel myRecentMessagesLabel; - @NotNull private final Url myOriginalURL; + private final @NotNull Url myOriginalURL; public MkdirOptionsDialog(Project project, @NotNull Url url) { super(project, true); @@ -51,7 +51,7 @@ public class MkdirOptionsDialog extends DialogWrapper { myNameField.selectAll(); myNameField.getDocument().addDocumentListener(new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { Url newUrl = getNewFolderUrl(); myURLLabel.setText(notNull(newUrl, myOriginalURL).toDecodedString()); @@ -78,8 +78,7 @@ public class MkdirOptionsDialog extends DialogWrapper { } @Override - @NonNls - protected String getDimensionServiceKey() { + protected @NonNls String getDimensionServiceKey() { return "svn4idea.mkdir.options"; } @@ -87,8 +86,7 @@ public class MkdirOptionsDialog extends DialogWrapper { return myCommitMessage.getText(); } - @Nullable - public Url getURL() { + public @Nullable Url getURL() { if (getOKAction().isEnabled()) { try { return createUrl(myURLLabel.getText(), false); @@ -104,8 +102,7 @@ public class MkdirOptionsDialog extends DialogWrapper { } @Override - @Nullable - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { return myMainPanel; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/OpeningExpander.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/OpeningExpander.java index dabb3a87e676..af0c2f6702b3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/OpeningExpander.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/OpeningExpander.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.util.NotNullFunction; @@ -53,8 +53,7 @@ public class OpeningExpander extends AbstractOpeningExpander { } @Override - @NotNull - public Expander fun(final RepositoryBrowserComponent repositoryBrowserComponent) { + public @NotNull Expander fun(final RepositoryBrowserComponent repositoryBrowserComponent) { return new OpeningExpander(myPath, repositoryBrowserComponent, mySelectionPath); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/UrlOpeningExpander.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/UrlOpeningExpander.java index 4e77b63dc2ab..a523dccb77de 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/UrlOpeningExpander.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/UrlOpeningExpander.java @@ -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 org.jetbrains.idea.svn.dialogs.browser; import com.intellij.util.NotNullFunction; @@ -10,7 +10,7 @@ import org.jetbrains.idea.svn.dialogs.browserCache.Expander; import static org.jetbrains.idea.svn.SvnUtil.isAncestor; public class UrlOpeningExpander extends AbstractOpeningExpander { - @NotNull private final Url myUrl; + private final @NotNull Url myUrl; UrlOpeningExpander(@NotNull RepositoryBrowserComponent browser, @NotNull Url selectionPath, @NotNull Url url) { super(browser, selectionPath); @@ -34,15 +34,14 @@ public class UrlOpeningExpander extends AbstractOpeningExpander { } public static class Factory implements NotNullFunction { - @NotNull private final Url myUrl; + private final @NotNull Url myUrl; public Factory(@NotNull Url url) { myUrl = url; } @Override - @NotNull - public Expander fun(final RepositoryBrowserComponent repositoryBrowserComponent) { + public @NotNull Expander fun(final RepositoryBrowserComponent repositoryBrowserComponent) { return new UrlOpeningExpander(repositoryBrowserComponent, myUrl, myUrl); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java index c40c4110c8de..5560ac5b1ceb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/CacheLoader.java @@ -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 org.jetbrains.idea.svn.dialogs.browserCache; import com.intellij.openapi.application.ApplicationManager; @@ -12,7 +12,7 @@ import java.util.List; public class CacheLoader extends Loader { - @NotNull private final Loader myRepositoryLoader; + private final @NotNull Loader myRepositoryLoader; public static Loader getInstance() { return ApplicationManager.getApplication().getService(Loader.class); @@ -24,7 +24,7 @@ public class CacheLoader extends Loader { } @Override - public void load(@NotNull final RepositoryTreeNode node, @NotNull final Expander expander) { + public void load(final @NotNull RepositoryTreeNode node, final @NotNull Expander expander) { SwingUtilities.invokeLater(() -> { final List cached = myCache.getChildren(node.getURL()); if (cached != null) { @@ -40,8 +40,7 @@ public class CacheLoader extends Loader { } @Override - @NotNull - protected NodeLoadState getNodeLoadState() { + protected @NotNull NodeLoadState getNodeLoadState() { return NodeLoadState.CACHED; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/KeepingExpandedExpander.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/KeepingExpandedExpander.java index 39a8f38d1b24..dc6465d9e022 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/KeepingExpandedExpander.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/KeepingExpandedExpander.java @@ -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 org.jetbrains.idea.svn.dialogs.browserCache; import com.intellij.util.NotNullFunction; @@ -76,8 +76,7 @@ public class KeepingExpandedExpander implements Expander { public static class Factory implements NotNullFunction { @Override - @NotNull - public Expander fun(final RepositoryBrowserComponent repositoryBrowserComponent) { + public @NotNull Expander fun(final RepositoryBrowserComponent repositoryBrowserComponent) { return new KeepingExpandedExpander(repositoryBrowserComponent); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java index c3f8d573685a..5d3591e2066a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/Loader.java @@ -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 org.jetbrains.idea.svn.dialogs.browserCache; import com.intellij.openapi.vcs.VcsException; @@ -11,7 +11,7 @@ import java.util.List; public abstract class Loader { - @NotNull protected final SvnRepositoryCache myCache; + protected final @NotNull SvnRepositoryCache myCache; protected Loader(@NotNull SvnRepositoryCache cache) { myCache = cache; @@ -19,8 +19,7 @@ public abstract class Loader { public abstract void load(@NotNull RepositoryTreeNode node, @NotNull Expander afterRefreshExpander); - @NotNull - protected abstract NodeLoadState getNodeLoadState(); + protected abstract @NotNull NodeLoadState getNodeLoadState(); protected void refreshNodeError(@NotNull RepositoryTreeNode node, @NotNull VcsException error) { RepositoryTreeNode existingNode = findExistingNode(node); @@ -40,8 +39,7 @@ public abstract class Loader { } } - @Nullable - private static RepositoryTreeNode findExistingNode(@NotNull RepositoryTreeNode node) { + private static @Nullable RepositoryTreeNode findExistingNode(@NotNull RepositoryTreeNode node) { RepositoryTreeNode result = null; if (!node.isDisposed()) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java index a2eec12557e5..0eae6e2dc6e7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/RepositoryLoader.java @@ -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 org.jetbrains.idea.svn.dialogs.browserCache; import com.intellij.openapi.progress.EmptyProgressIndicator; @@ -27,7 +27,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; class RepositoryLoader extends Loader { // may be several requests if: several same-level nodes are expanded simultaneosly; or browser can be opening into some expanded state - @NotNull private final Queue> myLoadQueue; + private final @NotNull Queue> myLoadQueue; private boolean myQueueProcessorActive; RepositoryLoader(@NotNull SvnRepositoryCache cache) { @@ -76,20 +76,19 @@ class RepositoryLoader extends Loader { } } - private void startLoadTask(@NotNull final Pair data) { + private void startLoadTask(final @NotNull Pair data) { ProgressManager.getInstance().runProcessWithProgressAsynchronously(new LoadTask(data), new EmptyProgressIndicator()); } @Override - @NotNull - protected NodeLoadState getNodeLoadState() { + protected @NotNull NodeLoadState getNodeLoadState() { return NodeLoadState.REFRESHED; } private final class LoadTask extends Task.Backgroundable { - @NotNull private final Pair myData; - @NotNull private final List entries = new ArrayList<>(); - @Nullable private VcsException error; + private final @NotNull Pair myData; + private final @NotNull List entries = new ArrayList<>(); + private @Nullable VcsException error; private LoadTask(@NotNull Pair data) { super(data.first.getVcs().getProject(), message("progress.title.loading.child.entries")); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java index 04dc88b059a2..5e48ab8eb52e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browserCache/SyntheticWorker.java @@ -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 org.jetbrains.idea.svn.dialogs.browserCache; import com.intellij.util.NotNullFunction; @@ -79,8 +79,7 @@ public class SyntheticWorker { private final SvnRepositoryCache myCache = SvnRepositoryCache.getInstance(); @Override - @NotNull - public Object fun(final RepositoryTreeNode repositoryTreeNode) { + public @NotNull Object fun(final RepositoryTreeNode repositoryTreeNode) { myCache.remove(repositoryTreeNode.getURL()); return Boolean.FALSE; } @@ -96,8 +95,7 @@ public class SyntheticWorker { } @Override - @NotNull - public Object fun(final RepositoryTreeNode repositoryTreeNode) { + public @NotNull Object fun(final RepositoryTreeNode repositoryTreeNode) { final List children = myCache.getChildren(repositoryTreeNode.getURL()); if (children == null) { return Boolean.FALSE; @@ -115,8 +113,7 @@ public class SyntheticWorker { return Boolean.FALSE; } - @NotNull - private Url convertUrl(@NotNull Url currentUrl) throws SvnBindException { + private @NotNull Url convertUrl(@NotNull Url currentUrl) throws SvnBindException { return append(myNewParentUrl, currentUrl.toString().substring(myOldPrefixLen), true); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java index e73e720b5e66..cace6ef5319f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/CmdDiffClient.java @@ -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 org.jetbrains.idea.svn.diff; import com.intellij.openapi.diagnostic.Logger; @@ -39,9 +39,8 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { private static final Logger LOG = Logger.getInstance(CmdDiffClient.class); - @NotNull @Override - public List compare(@NotNull Target target1, @NotNull Target target2) throws VcsException { + public @NotNull List compare(@NotNull Target target1, @NotNull Target target2) throws VcsException { assertUrl(target1); if (target2.isFile()) { // Such combination (file and url) with "--summarize" option is supported only in svn 1.8. @@ -84,8 +83,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { } } - @NotNull - private List parseOutput(@NotNull Target target1, @NotNull Target target2, @NotNull CommandExecutor executor) + private @NotNull List parseOutput(@NotNull Target target1, @NotNull Target target2, @NotNull CommandExecutor executor) throws SvnBindException { try { DiffInfo diffInfo = CommandUtil.parse(executor.getOutput(), DiffInfo.class); @@ -104,11 +102,10 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { } } - @NotNull - private ContentRevision createRevision(@NotNull FilePath path, - @NotNull FilePath localPath, - @NotNull Revision revision, - @NotNull FileStatus status) { + private @NotNull ContentRevision createRevision(@NotNull FilePath path, + @NotNull FilePath localPath, + @NotNull Revision revision, + @NotNull FileStatus status) { ContentRevision result; if (path.isNonLocal()) { @@ -130,8 +127,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { : VcsUtil.getFilePathOnNonLocal(SvnUtil.toDecodedString(target), isDirectory); } - @NotNull - private Change createChange(@NotNull Target target1, @NotNull Target target2, @NotNull DiffPath diffPath) throws SvnBindException { + private @NotNull Change createChange(@NotNull Target target1, @NotNull Target target2, @NotNull DiffPath diffPath) throws SvnBindException { // TODO: 1) Unify logic of creating Change instance with SvnChangeProviderContext // TODO: 2) If some directory is switched, files inside it are returned as modified in "svn diff --summarize", even if they are equal // TODO: to branch files by content - possibly add separate processing of all switched files @@ -162,10 +158,9 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { return createChange(status, beforeRevision, afterRevision); } - @NotNull - private static Change createChange(@NotNull final FileStatus status, - @Nullable final ContentRevision beforeRevision, - @Nullable final ContentRevision afterRevision) { + private static @NotNull Change createChange(final @NotNull FileStatus status, + final @Nullable ContentRevision beforeRevision, + final @Nullable ContentRevision afterRevision) { // isRenamed() and isMoved() are always false here not to have text like "moved from ..." in changes window - by default different // paths in before and after revisions are treated as move, but this is not the case for "Compare with Branch" return new Change(beforeRevision, afterRevision, status) { @@ -181,8 +176,7 @@ public class CmdDiffClient extends BaseSvnClient implements DiffClient { }; } - @Nullable - private static StatusType getStatus(@NotNull String code) { + private static @Nullable StatusType getStatus(@NotNull String code) { StatusType result = StatusType.forStatusOperation(code); if (result == null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java index 2526dd75fef8..f2becf453b3c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/DirectoryWithBranchComparer.java @@ -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 org.jetbrains.idea.svn.diff; import com.intellij.openapi.project.Project; @@ -24,7 +24,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class DirectoryWithBranchComparer extends ElementWithBranchComparer { private final @DialogTitle @NotNull StringBuilder titleBuilder = new StringBuilder(); - @NotNull private final List changes = new ArrayList<>(); + private final @NotNull List changes = new ArrayList<>(); public DirectoryWithBranchComparer(@NotNull Project project, @NotNull VirtualFile virtualFile, @@ -44,13 +44,11 @@ public class DirectoryWithBranchComparer extends ElementWithBranchComparer { changes.addAll(getClientFactory().createDiffClient().compare(target1, target2)); } - @NotNull - private ClientFactory getClientFactory() { + private @NotNull ClientFactory getClientFactory() { return getClientFactory(myVcs, virtualToIoFile(myVirtualFile)); } - @NotNull - public static ClientFactory getClientFactory(@NotNull SvnVcs vcs, @NotNull File file) { + public static @NotNull ClientFactory getClientFactory(@NotNull SvnVcs vcs, @NotNull File file) { // TODO: Fix for svn 1.7 and lower as svn 1.7 command line "--summarize" option for "diff" command does not support comparing working // TODO: copy directories with repository directories return vcs.getFactory(file); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/ElementWithBranchComparer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/ElementWithBranchComparer.java index bddee2cdfd73..e17e661c85d5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/ElementWithBranchComparer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/ElementWithBranchComparer.java @@ -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 org.jetbrains.idea.svn.diff; import com.intellij.openapi.diagnostic.Logger; @@ -25,10 +25,10 @@ public abstract class ElementWithBranchComparer { private static final Logger LOG = Logger.getInstance(ElementWithBranchComparer.class); - @NotNull protected final Project myProject; - @NotNull protected final SvnVcs myVcs; - @NotNull protected final VirtualFile myVirtualFile; - @NotNull protected final Url myBranchUrl; + protected final @NotNull Project myProject; + protected final @NotNull SvnVcs myVcs; + protected final @NotNull VirtualFile myVirtualFile; + protected final @NotNull Url myBranchUrl; protected final long myBranchRevision; protected Url myElementUrl; @@ -77,8 +77,7 @@ public abstract class ElementWithBranchComparer { public abstract @DialogTitle @NotNull String getTitle(); - @Nullable - protected Url resolveElementUrl() throws SvnBindException { + protected @Nullable Url resolveElementUrl() throws SvnBindException { final SvnFileUrlMapping urlMapping = myVcs.getSvnFileUrlMapping(); final File file = virtualToIoFile(myVirtualFile); final Url fileUrl = urlMapping.getUrlForFile(file); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java index 07be04204351..ca35eac41b50 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/diff/FileWithBranchComparer.java @@ -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 org.jetbrains.idea.svn.diff; import com.intellij.diff.DiffContentFactory; @@ -24,9 +24,9 @@ import java.io.IOException; public class FileWithBranchComparer extends ElementWithBranchComparer { - @NotNull private final Ref content = new Ref<>(); + private final @NotNull Ref content = new Ref<>(); private final @NlsContexts.Label @NotNull StringBuilder remoteTitleBuilder = new StringBuilder(); - @NotNull private final Ref success = new Ref<>(); + private final @NotNull Ref success = new Ref<>(); public FileWithBranchComparer(@NotNull Project project, @NotNull VirtualFile virtualFile, diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnChangeDiffViewerProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnChangeDiffViewerProvider.java index 34f663a46ecc..8240136185e1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnChangeDiffViewerProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnChangeDiffViewerProvider.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.idea.svn.difftool; import com.intellij.diff.chains.DiffRequestProducerException; @@ -29,9 +30,8 @@ import java.util.Map; public class SvnChangeDiffViewerProvider implements ChangeDiffViewerWrapperProvider { private static final Logger LOG = Logger.getInstance(SvnChangeDiffViewerProvider.class); - @NotNull @Override - public ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) { + public @NotNull ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) { Change layer1 = getSvnChangeLayer(change1); Change layer2 = getSvnChangeLayer(change2); if (layer1 != null || layer2 != null) { @@ -45,19 +45,17 @@ public class SvnChangeDiffViewerProvider implements ChangeDiffViewerWrapperProvi return getSvnChangeLayer(change) != null; // TODO: do not show, if no properties are set in both revisions ? } - @NotNull @Override - public DiffViewerWrapper process(@NotNull ChangeDiffRequestProducer presentable, - @NotNull UserDataHolder context, - @NotNull ProgressIndicator indicator) throws DiffRequestProducerException, ProcessCanceledException { + public @NotNull DiffViewerWrapper process(@NotNull ChangeDiffRequestProducer presentable, + @NotNull UserDataHolder context, + @NotNull ProgressIndicator indicator) throws DiffRequestProducerException, ProcessCanceledException { // TODO: support properties conflict for three-way-diff DiffRequest propertyRequest = createPropertyRequest(presentable.getChange(), indicator); return new SvnDiffViewerWrapper(propertyRequest); } - @NotNull - private static SvnPropertiesDiffRequest createPropertyRequest(@NotNull Change change, @NotNull ProgressIndicator indicator) + private static @NotNull SvnPropertiesDiffRequest createPropertyRequest(@NotNull Change change, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException { try { Change propertiesChange = getSvnChangeLayer(change); @@ -98,8 +96,7 @@ public class SvnChangeDiffViewerProvider implements ChangeDiffViewerWrapperProvi } } - @Nullable - private static Change getSvnChangeLayer(@NotNull Change change) { + private static @Nullable Change getSvnChangeLayer(@NotNull Change change) { for (Map.Entry entry : change.getOtherLayers().entrySet()) { if (SvnChangeProvider.PROPERTY_LAYER.equals(entry.getKey())) { if (change.getOtherLayers().size() != 1) LOG.warn("Some of change layers ignored"); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java index 92743262d57f..edc4d42b44d8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewer.java @@ -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 org.jetbrains.idea.svn.difftool; import com.intellij.diff.DiffContext; @@ -41,8 +41,8 @@ import java.awt.*; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; -import java.util.List; import java.util.*; +import java.util.List; import static org.jetbrains.idea.svn.SvnBundle.message; @@ -52,22 +52,22 @@ public class SvnDiffViewer implements DiffViewer { public static final Key PROPERTY_CONTEXT_KEY = Key.create("MyPropertyContext"); public static final Key FOCUSED_VIEWER_KEY = Key.create("SvnFocusedViewer"); - @Nullable private final Project myProject; + private final @Nullable Project myProject; - @NotNull private final DiffContext myContext; - @NotNull private final DiffRequest myPropertyRequest; + private final @NotNull DiffContext myContext; + private final @NotNull DiffRequest myPropertyRequest; - @NotNull private final SvnDiffSettings mySettings; + private final @NotNull SvnDiffSettings mySettings; - @NotNull private final JPanel myPanel; - @NotNull private final Splitter mySplitter; - @NotNull private final Wrapper myNotificationPanel; + private final @NotNull JPanel myPanel; + private final @NotNull Splitter mySplitter; + private final @NotNull Wrapper myNotificationPanel; - @NotNull private final DiffViewer myContentViewer; - @NotNull private final DiffViewer myPropertiesViewer; + private final @NotNull DiffViewer myContentViewer; + private final @NotNull DiffViewer myPropertiesViewer; - @NotNull private final FocusListener myContentFocusListener = new MyFocusListener(false); - @NotNull private final FocusListener myPropertiesFocusListener = new MyFocusListener(true); + private final @NotNull FocusListener myContentFocusListener = new MyFocusListener(false); + private final @NotNull FocusListener myPropertiesFocusListener = new MyFocusListener(true); private boolean myPropertiesViewerFocused; // False - content viewer, True - properties private boolean myDumbContentViewer; @@ -98,8 +98,7 @@ public class SvnDiffViewer implements DiffViewer { updatePropertiesPanel(); } - @NotNull - private static DiffViewer createPropertiesViewer(@NotNull DiffRequest propertyRequest, @NotNull MyPropertyContext propertyContext) { + private static @NotNull DiffViewer createPropertiesViewer(@NotNull DiffRequest propertyRequest, @NotNull MyPropertyContext propertyContext) { if (propertyRequest instanceof SvnPropertiesDiffRequest) { return SvnPropertiesDiffViewer.create(propertyContext, ((SvnPropertiesDiffRequest)propertyRequest), true); } @@ -108,9 +107,8 @@ public class SvnDiffViewer implements DiffViewer { } } - @NotNull @Override - public ToolbarComponents init() { + public @NotNull ToolbarComponents init() { installListeners(); processContextHints(); @@ -146,8 +144,7 @@ public class SvnDiffViewer implements DiffViewer { // Diff // - @Nullable - private JComponent createNotification() { + private @Nullable JComponent createNotification() { if (myPropertyRequest instanceof ErrorDiffRequest) { return createNotification(((ErrorDiffRequest)myPropertyRequest).getMessage(), EditorNotificationPanel.Status.Error); } @@ -172,8 +169,7 @@ public class SvnDiffViewer implements DiffViewer { return null; } - @NotNull - private static Map getProperties(@NotNull DiffContent content) { + private static @NotNull Map getProperties(@NotNull DiffContent content) { if (content instanceof EmptyContent) return Collections.emptyMap(); List properties = ((SvnPropertiesDiffRequest.PropertyContent)content).getProperties(); @@ -188,8 +184,7 @@ public class SvnDiffViewer implements DiffViewer { return map; } - @NotNull - private static JPanel createNotification(@NlsContexts.Label @NotNull String text, @NotNull EditorNotificationPanel.Status status) { + private static @NotNull JPanel createNotification(@NlsContexts.Label @NotNull String text, @NotNull EditorNotificationPanel.Status status) { return new EditorNotificationPanel(status).text(text); } @@ -210,8 +205,7 @@ public class SvnDiffViewer implements DiffViewer { }); } - @NotNull - private List createToolbar(@Nullable List propertiesActions) { + private @NotNull List createToolbar(@Nullable List propertiesActions) { List result = new ArrayList<>(); if (propertiesActions != null) result.addAll(propertiesActions); @@ -221,8 +215,7 @@ public class SvnDiffViewer implements DiffViewer { return result; } - @NotNull - private static SvnDiffSettings initSettings(@NotNull DiffContext context) { + private static @NotNull SvnDiffSettings initSettings(@NotNull DiffContext context) { SvnDiffSettings settings = context.getUserData(SvnDiffSettings.KEY); if (settings == null) { settings = SvnDiffSettings.getSettings(); @@ -231,8 +224,7 @@ public class SvnDiffViewer implements DiffViewer { return settings; } - @NotNull - private MyPropertyContext initPropertyContext(@NotNull DiffContext context) { + private @NotNull MyPropertyContext initPropertyContext(@NotNull DiffContext context) { MyPropertyContext propertyContext = context.getUserData(PROPERTY_CONTEXT_KEY); if (propertyContext == null) { propertyContext = new MyPropertyContext(); @@ -255,15 +247,13 @@ public class SvnDiffViewer implements DiffViewer { // Getters // - @NotNull @Override - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return myPanel; } - @Nullable @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { if (myPropertiesViewerFocused) { JComponent component = getPropertiesPreferredFocusedComponent(); if (component != null) return component; @@ -276,8 +266,7 @@ public class SvnDiffViewer implements DiffViewer { } } - @Nullable - private JComponent getPropertiesPreferredFocusedComponent() { + private @Nullable JComponent getPropertiesPreferredFocusedComponent() { if (mySettings.isHideProperties()) return null; return myPropertiesViewer.getPreferredFocusedComponent(); } @@ -331,9 +320,8 @@ public class SvnDiffViewer implements DiffViewer { } private class MyPropertyContext extends DiffContext { - @Nullable @Override - public Project getProject() { + public @Nullable Project getProject() { return myContext.getProject(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewerWrapper.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewerWrapper.java index 32c1be6d128b..d454eec90da3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewerWrapper.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnDiffViewerWrapper.java @@ -1,3 +1,4 @@ +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.idea.svn.difftool; import com.intellij.diff.DiffContext; @@ -7,7 +8,7 @@ import com.intellij.diff.requests.DiffRequest; import org.jetbrains.annotations.NotNull; public class SvnDiffViewerWrapper implements DiffViewerWrapper { - @NotNull private final DiffRequest myPropertyRequest; + private final @NotNull DiffRequest myPropertyRequest; public SvnDiffViewerWrapper(@NotNull DiffRequest propertyRequest) { myPropertyRequest = propertyRequest; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnPhantomChangeDiffRequestProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnPhantomChangeDiffRequestProvider.java index cae94a59e9d9..5228ccf44d57 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnPhantomChangeDiffRequestProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnPhantomChangeDiffRequestProvider.java @@ -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 org.jetbrains.idea.svn.difftool; import com.intellij.diff.DiffContext; @@ -22,9 +22,8 @@ import javax.swing.*; import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnPhantomChangeDiffRequestProvider implements ChangeDiffRequestProvider { - @NotNull @Override - public ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) { + public @NotNull ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) { return ThreeState.UNSURE; } @@ -33,33 +32,30 @@ public class SvnPhantomChangeDiffRequestProvider implements ChangeDiffRequestPro return change instanceof ConflictedSvnChange && ((ConflictedSvnChange)change).isPhantom(); } - @NotNull @Override - public DiffRequest process(@NotNull ChangeDiffRequestProducer presentable, - @NotNull UserDataHolder context, - @NotNull ProgressIndicator indicator) throws ProcessCanceledException { + public @NotNull DiffRequest process(@NotNull ChangeDiffRequestProducer presentable, + @NotNull UserDataHolder context, + @NotNull ProgressIndicator indicator) throws ProcessCanceledException { indicator.checkCanceled(); return new SvnPhantomDiffRequest(presentable.getChange()); } public static class SvnPhantomDiffRequest extends DiffRequest { - @NotNull private final Change myChange; + private final @NotNull Change myChange; public SvnPhantomDiffRequest(@NotNull Change change) { myChange = change; } - @Nullable @Override - public String getTitle() { + public @Nullable String getTitle() { return ChangeDiffRequestProducer.getRequestTitle(myChange); } } public static class SvnPhantomDiffTool implements FrameDiffTool { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return message("svn.phantom.changes.viewer"); } @@ -68,25 +64,21 @@ public class SvnPhantomChangeDiffRequestProvider implements ChangeDiffRequestPro return request instanceof SvnPhantomDiffRequest; } - @NotNull @Override - public DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { + public @NotNull DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { return new DiffViewer() { - @NotNull @Override - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return UIVcsUtil.infoPanel(message("label.svn.phantom.change"), message("text.svn.phantom.change")); } - @Nullable @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return null; } - @NotNull @Override - public ToolbarComponents init() { + public @NotNull ToolbarComponents init() { return new ToolbarComponents(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnTreeConflictDiffRequestProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnTreeConflictDiffRequestProvider.java index d34439c618fc..43b517929ba9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnTreeConflictDiffRequestProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/SvnTreeConflictDiffRequestProvider.java @@ -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 org.jetbrains.idea.svn.difftool; import com.intellij.diff.DiffContext; @@ -26,9 +26,8 @@ import javax.swing.*; import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnTreeConflictDiffRequestProvider implements ChangeDiffRequestProvider { - @NotNull @Override - public ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) { + public @NotNull ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) { if (change1 instanceof ConflictedSvnChange conflict1 && change2 instanceof ConflictedSvnChange conflict2) { if (!conflict1.isTreeConflict() && !conflict2.isTreeConflict()) return ThreeState.UNSURE; @@ -46,37 +45,33 @@ public class SvnTreeConflictDiffRequestProvider implements ChangeDiffRequestProv return change instanceof ConflictedSvnChange && ((ConflictedSvnChange)change).getConflictState().isTree(); } - @NotNull @Override - public DiffRequest process(@NotNull ChangeDiffRequestProducer presentable, - @NotNull UserDataHolder context, - @NotNull ProgressIndicator indicator) throws ProcessCanceledException { + public @NotNull DiffRequest process(@NotNull ChangeDiffRequestProducer presentable, + @NotNull UserDataHolder context, + @NotNull ProgressIndicator indicator) throws ProcessCanceledException { return new SvnTreeConflictDiffRequest(((ConflictedSvnChange)presentable.getChange())); } public static class SvnTreeConflictDiffRequest extends DiffRequest { - @NotNull private final ConflictedSvnChange myChange; + private final @NotNull ConflictedSvnChange myChange; public SvnTreeConflictDiffRequest(@NotNull ConflictedSvnChange change) { myChange = change; } - @NotNull - public ConflictedSvnChange getChange() { + public @NotNull ConflictedSvnChange getChange() { return myChange; } - @Nullable @Override - public String getTitle() { + public @Nullable String getTitle() { return ChangeDiffRequestProducer.getRequestTitle(myChange); } } public static class SvnTreeConflictDiffTool implements FrameDiffTool { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return message("svn.tree.conflict.viewer"); } @@ -85,20 +80,19 @@ public class SvnTreeConflictDiffRequestProvider implements ChangeDiffRequestProv return request instanceof SvnTreeConflictDiffRequest; } - @NotNull @Override - public DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { + public @NotNull DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { return new SvnTreeConflictDiffViewer(context, (SvnTreeConflictDiffRequest)request); } } private static class SvnTreeConflictDiffViewer implements FrameDiffTool.DiffViewer { - @NotNull private final DiffContext myContext; - @NotNull private final SvnTreeConflictDiffRequest myRequest; - @NotNull private final Wrapper myPanel = new Wrapper(); + private final @NotNull DiffContext myContext; + private final @NotNull SvnTreeConflictDiffRequest myRequest; + private final @NotNull Wrapper myPanel = new Wrapper(); - @NotNull private final BackgroundTaskQueue myQueue; - @NotNull private final TreeConflictRefreshablePanel myDelegate; + private final @NotNull BackgroundTaskQueue myQueue; + private final @NotNull TreeConflictRefreshablePanel myDelegate; SvnTreeConflictDiffViewer(@NotNull DiffContext context, @NotNull SvnTreeConflictDiffRequest request) { myContext = context; @@ -113,21 +107,18 @@ public class SvnTreeConflictDiffRequestProvider implements ChangeDiffRequestProv myPanel.setContent(myDelegate.getPanel()); } - @NotNull @Override - public JComponent getComponent() { + public @NotNull JComponent getComponent() { return myPanel; } - @Nullable @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myPanel; } - @NotNull @Override - public FrameDiffTool.ToolbarComponents init() { + public @NotNull FrameDiffTool.ToolbarComponents init() { return new FrameDiffTool.ToolbarComponents(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java index 1086cc32ee53..ce9f9b2461d1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffRequest.java @@ -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 org.jetbrains.idea.svn.difftool.properties; import com.intellij.diff.contents.DiffContent; @@ -16,8 +16,8 @@ import java.util.List; import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnPropertiesDiffRequest extends ContentDiffRequest { - @NotNull private final List myContents; - @NotNull private final List myContentTitles; + private final @NotNull List myContents; + private final @NotNull List myContentTitles; public SvnPropertiesDiffRequest(@Nullable List before, @Nullable List after, @Nullable String title1, @Nullable String title2) { @@ -27,46 +27,40 @@ public class SvnPropertiesDiffRequest extends ContentDiffRequest { myContentTitles = Arrays.asList(title1, title2); } - @NotNull - public DiffContent createContent(@Nullable List content) { + public @NotNull DiffContent createContent(@Nullable List content) { if (content == null) return new EmptyContent(); return new PropertyContent(content); } - @NotNull @Override - public String getTitle() { + public @NotNull String getTitle() { return message("dialog.title.svn.properties.diff"); } - @NotNull @Override - public List getContentTitles() { + public @NotNull List getContentTitles() { return myContentTitles; } - @NotNull @Override - public List getContents() { + public @NotNull List getContents() { return myContents; } public static class PropertyContent extends DiffContentBase { - @NotNull private final List myProperties; + private final @NotNull List myProperties; public PropertyContent(@NotNull List properties) { myProperties = properties; } - @NotNull - public List getProperties() { + public @NotNull List getProperties() { return myProperties; } - @Nullable @Override - public FileType getContentType() { + public @Nullable FileType getContentType() { return null; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffTool.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffTool.java index d04abdbe8f51..3a194441d79e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffTool.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffTool.java @@ -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 org.jetbrains.idea.svn.difftool.properties; import com.intellij.diff.DiffContext; @@ -9,9 +9,8 @@ import org.jetbrains.annotations.NotNull; import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnPropertiesDiffTool implements FrameDiffTool { - @NotNull @Override - public String getName() { + public @NotNull String getName() { return message("svn.properties.viewer"); } @@ -20,9 +19,8 @@ public class SvnPropertiesDiffTool implements FrameDiffTool { return request instanceof SvnPropertiesDiffRequest; } - @NotNull @Override - public DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { + public @NotNull DiffViewer createComponent(@NotNull DiffContext context, @NotNull DiffRequest request) { return SvnPropertiesDiffViewer.create(context, (SvnPropertiesDiffRequest)request); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffViewer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffViewer.java index b379e04ebe8d..63905e8a1181 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffViewer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/difftool/properties/SvnPropertiesDiffViewer.java @@ -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 org.jetbrains.idea.svn.difftool.properties; import com.intellij.diff.DiffContentFactory; @@ -47,23 +47,21 @@ import org.jetbrains.idea.svn.properties.PropertyValue; import javax.swing.*; import java.awt.*; import java.awt.geom.AffineTransform; -import java.util.List; import java.util.*; +import java.util.List; public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { private static final @NonNls String HELP_ID = "topicId758145"; - @NotNull private final List myDiffChanges; + private final @NotNull List myDiffChanges; private boolean myFirstRediff = true; - @NotNull - public static SvnPropertiesDiffViewer create(@NotNull DiffContext context, @NotNull SvnPropertiesDiffRequest request) { + public static @NotNull SvnPropertiesDiffViewer create(@NotNull DiffContext context, @NotNull SvnPropertiesDiffRequest request) { return create(context, request, false); } - @NotNull - public static SvnPropertiesDiffViewer create(@NotNull DiffContext context, @NotNull SvnPropertiesDiffRequest request, boolean embedded) { + public static @NotNull SvnPropertiesDiffViewer create(@NotNull DiffContext context, @NotNull SvnPropertiesDiffRequest request, boolean embedded) { Pair> pair = convertRequest(request, embedded); return new SvnPropertiesDiffViewer(context, pair.first, pair.second); } @@ -109,9 +107,8 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { myContentPanel.setPainter(new MyDividerPainter()); } - @NotNull @Override - protected Runnable performRediff(@NotNull ProgressIndicator indicator) { + protected @NotNull Runnable performRediff(@NotNull ProgressIndicator indicator) { if (!myFirstRediff) return new EmptyRunnable(); myFirstRediff = false; @@ -183,13 +180,12 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { } } - @NotNull - private static List createEverythingChanged(int length1, int length2, int lines1, int lines2) { + private static @NotNull List createEverythingChanged(int length1, int length2, int lines1, int lines2) { return Collections.singletonList(new LineFragmentImpl(0, lines1, 0, lines2, 0, length1, 0, length2)); } private class MyDividerPainter implements DiffSplitter.Painter, DiffDividerDrawUtil.DividerPaintable { - @NotNull private final JBLabel myLabel; + private final @NotNull JBLabel myLabel; MyDividerPainter() { myLabel = new JBLabel(); @@ -267,8 +263,7 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { } } - @Nullable - private Color getRecordTitleColor(@NotNull DiffChange change) { + private @Nullable Color getRecordTitleColor(@NotNull DiffChange change) { TextDiffType type = getDiffType(change); if (type == TextDiffType.INSERTED) return FileStatus.ADDED.getColor(); if (type == TextDiffType.DELETED) return FileStatus.DELETED.getColor(); @@ -276,8 +271,7 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { return JBColor.black; // unchanged } - @Nullable - public TextDiffType getDiffType(@NotNull DiffChange change) { + public @Nullable TextDiffType getDiffType(@NotNull DiffChange change) { if (change.getRecord().getBefore() == null) return TextDiffType.INSERTED; if (change.getRecord().getAfter() == null) return TextDiffType.DELETED; if (change.getFragments() != null && !change.getFragments().isEmpty()) return TextDiffType.MODIFIED; @@ -295,9 +289,8 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { // - @Nullable @Override - protected SyncScrollSupport.SyncScrollable getSyncScrollable() { + protected @Nullable SyncScrollSupport.SyncScrollable getSyncScrollable() { return new SyncScrollSupport.SyncScrollable() { @Override public boolean isSyncScrollEnabled() { @@ -309,9 +302,8 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { return line; } - @NotNull @Override - public Range getRange(@NotNull Side baseSide, int line) { + public @NotNull Range getRange(@NotNull Side baseSide, int line) { return BaseSyncScrollable.idRange(line); } }; @@ -327,8 +319,7 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { // Initial step // - @NotNull - private static Pair> convertRequest(@NotNull SvnPropertiesDiffRequest request, boolean embedded) { + private static @NotNull Pair> convertRequest(@NotNull SvnPropertiesDiffRequest request, boolean embedded) { List records = collectRecords(request); StringBuilder builder1 = new StringBuilder(); @@ -366,8 +357,7 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { return Pair.create(proxyRequest, diffChanges); } - @NotNull - private static List collectRecords(@NotNull SvnPropertiesDiffRequest request) { + private static @NotNull List collectRecords(@NotNull SvnPropertiesDiffRequest request) { List originalContents = request.getContents(); List properties1 = getProperties(originalContents.get(0)); List properties2 = getProperties(originalContents.get(1)); @@ -395,16 +385,14 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { return records; } - @Nullable - private static List getProperties(@NotNull DiffContent content) { + private static @Nullable List getProperties(@NotNull DiffContent content) { if (content instanceof SvnPropertiesDiffRequest.PropertyContent) { return ((SvnPropertiesDiffRequest.PropertyContent)content).getProperties(); } return null; } - @NotNull - private static PropertyRecord createRecord(@NotNull String name, @Nullable PropertyValue value1, @Nullable PropertyValue value2) { + private static @NotNull PropertyRecord createRecord(@NotNull String name, @Nullable PropertyValue value1, @Nullable PropertyValue value2) { assert value1 != null || value2 != null; String text1 = value1 != null ? value1.toString() : null; @@ -422,9 +410,9 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { // private static class PropertyRecord { - @NotNull private final String myName; - @Nullable private final String myBefore; - @Nullable private final String myAfter; + private final @NotNull String myName; + private final @Nullable String myBefore; + private final @Nullable String myAfter; PropertyRecord(@NotNull String name, @Nullable String before, @Nullable String after) { assert before != null || after != null; @@ -438,25 +426,23 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { return myName; } - @Nullable - public String getBefore() { + public @Nullable String getBefore() { return myBefore; } - @Nullable - public String getAfter() { + public @Nullable String getAfter() { return myAfter; } } private static class DiffChange { - @NotNull private final PropertyRecord myRecord; + private final @NotNull PropertyRecord myRecord; private final int myStartLine1; private final int myEndLine1; private final int myStartLine2; private final int myEndLine2; - @Nullable private List myFragments; + private @Nullable List myFragments; DiffChange(@NotNull PropertyRecord record, int startLine1, int endLine1, int startLine2, int endLine2) { myRecord = record; @@ -466,8 +452,7 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { myEndLine2 = endLine2; } - @NotNull - public PropertyRecord getRecord() { + public @NotNull PropertyRecord getRecord() { return myRecord; } @@ -483,8 +468,7 @@ public final class SvnPropertiesDiffViewer extends TwosideTextDiffViewer { myFragments = fragments; } - @Nullable - public List getFragments() { + public @Nullable List getFragments() { return myFragments; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CachedProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CachedProvider.java index 574b6d4076ed..e3d7debf2bc5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CachedProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/CachedProvider.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.changes.committed.ChangesBunch; @@ -71,9 +71,8 @@ public abstract class CachedProvider implements BunchProvider { } @Override - @Nullable - public Fragment getEarliestBunchInInterval(final long earliestRevision, final long oldestRevision, final int desirableSize, - final boolean includeYoungest, final boolean includeOldest) { + public @Nullable Fragment getEarliestBunchInInterval(final long earliestRevision, final long oldestRevision, final int desirableSize, + final boolean includeYoungest, final boolean includeOldest) { if ((earliestRevision > getEarliestRevision()) || (earliestRevision == -1)) { if (myAlreadyReaded == null) { return null; @@ -125,9 +124,8 @@ public abstract class CachedProvider implements BunchProvider { return myHadBeenAccessed; } - @Nullable - private Fragment createFromLoaded(final ChangesBunch loadedBunch, final long earliestRevision, final long oldestRevision, - final int desirableSize, final boolean includeYoungest, final boolean includeOldest, final boolean consistent) { + private @Nullable Fragment createFromLoaded(final ChangesBunch loadedBunch, final long earliestRevision, final long oldestRevision, + final int desirableSize, final boolean includeYoungest, final boolean includeOldest, final boolean consistent) { boolean consistentWithPrevious = loadedBunch.isConsistentWithPrevious(); boolean consistentWithYounger = consistent; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java index e92a84240dc1..0b9c0a95256b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/FirstInBranch.java @@ -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 org.jetbrains.idea.svn.history; import com.google.common.base.MoreObjects; @@ -27,10 +27,10 @@ public class FirstInBranch { private static final Logger LOG = Logger.getInstance(FirstInBranch.class); - @NotNull private final SvnVcs myVcs; - @NotNull private final Url myAbsoluteBranchUrl; - @NotNull private final Url myAbsoluteTrunkUrl; - @NotNull private final Url myRepositoryRoot; + private final @NotNull SvnVcs myVcs; + private final @NotNull Url myAbsoluteBranchUrl; + private final @NotNull Url myAbsoluteTrunkUrl; + private final @NotNull Url myRepositoryRoot; public FirstInBranch(@NotNull SvnVcs vcs, @NotNull Url repositoryRoot, @NotNull Url branchUrl, @NotNull Url trunkUrl) { myVcs = vcs; @@ -39,8 +39,7 @@ public class FirstInBranch { myAbsoluteTrunkUrl = trunkUrl; } - @Nullable - public CopyData run() throws VcsException { + public @Nullable CopyData run() throws VcsException { Target trunk = Target.on(myAbsoluteTrunkUrl, Revision.HEAD); Target branch = Target.on(myAbsoluteBranchUrl, Revision.HEAD); CopyData result = find(new BranchPoint(trunk), new BranchPoint(branch), true); @@ -50,8 +49,7 @@ public class FirstInBranch { return result; } - @Nullable - private CopyData find(@NotNull BranchPoint trunk, @NotNull BranchPoint branch, boolean isBranchFromTrunk) throws VcsException { + private @Nullable CopyData find(@NotNull BranchPoint trunk, @NotNull BranchPoint branch, boolean isBranchFromTrunk) throws VcsException { CopyData result = null; debug(trunk, branch, isBranchFromTrunk); @@ -104,9 +102,9 @@ public class FirstInBranch { } private final class BranchPoint { - @NotNull private final Target myTarget; - @Nullable private LogEntry myEntry; - @Nullable private LogEntryPath myPath; + private final @NotNull Target myTarget; + private @Nullable LogEntry myEntry; + private @Nullable LogEntryPath myPath; private BranchPoint(@NotNull Target target) { myTarget = target; @@ -132,8 +130,7 @@ public class FirstInBranch { } } - @NotNull - private Pair getCopyPoint() throws VcsException { + private @NotNull Pair getCopyPoint() throws VcsException { HistoryClient client = myVcs.getFactory(myTarget).createHistoryClient(); Ref entry = Ref.create(); @@ -157,8 +154,7 @@ public class FirstInBranch { return Objects.requireNonNull(myPath).getCopyPath() != null; } - @NotNull - private String copyPath() throws VcsException { + private @NotNull String copyPath() throws VcsException { init(); return Objects.requireNonNull(myPath).getCopyPath(); } @@ -168,13 +164,11 @@ public class FirstInBranch { return Objects.requireNonNull(myPath).getCopyRevision(); } - @NotNull - private Target copyTarget() throws VcsException { + private @NotNull Target copyTarget() throws VcsException { return Target.on(append(myRepositoryRoot, copyPath()), Revision.of(copyRevision())); } - @NotNull - private String relativePath() { + private @NotNull String relativePath() { return ensureStartSlash(getRelativeUrl(myRepositoryRoot, myTarget.getUrl())); } @@ -183,8 +177,7 @@ public class FirstInBranch { return Objects.requireNonNull(myEntry).getRevision(); } - @NotNull - private CopyData toCopyData(boolean isBranchFromTrunk) throws VcsException { + private @NotNull CopyData toCopyData(boolean isBranchFromTrunk) throws VcsException { return new CopyData(copyRevision(), revision(), isBranchFromTrunk); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/Fragment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/Fragment.java index 98e734a49a62..2aa7af1fd596 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/Fragment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/Fragment.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.changes.committed.ChangesBunch; @@ -26,8 +12,7 @@ public class Fragment { private final List myList; private final boolean myConsistentWithOlder; private final boolean myConsistentWithYounger; - @Nullable - private final ChangesBunch myOriginBunch; + private final @Nullable ChangesBunch myOriginBunch; public Fragment(final Origin origin, final List list, final boolean consistentWithOlder, final boolean consistentWithYounger, final ChangesBunch originBunch) { @@ -46,8 +31,7 @@ public class Fragment { return myList; } - @Nullable - public ChangesBunch getOriginBunch() { + public @Nullable ChangesBunch getOriginBunch() { return myOriginBunch; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java index f3fa088ece55..4fd0d12739be 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LatestExistentSearcher.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.diagnostic.Logger; @@ -31,9 +31,9 @@ public class LatestExistentSearcher { private long myStartNumber; private boolean myStartExistsKnown; - @NotNull private final Url myUrl; - @NotNull private final Url myRepositoryUrl; - @NotNull private final String myRelativeUrl; + private final @NotNull Url myUrl; + private final @NotNull Url myRepositoryUrl; + private final @NotNull String myRelativeUrl; private final SvnVcs myVcs; private long myEndNumber; @@ -83,8 +83,7 @@ public class LatestExistentSearcher { return latest.get().longValue(); } - @NotNull - private LogEntryConsumer createHandler(@NotNull final Ref latest) { + private @NotNull LogEntryConsumer createHandler(final @NotNull Ref latest) { return logEntry -> { final Map changedPaths = logEntry.getChangedPaths(); for (Object o : changedPaths.values()) { @@ -134,8 +133,7 @@ public class LatestExistentSearcher { return true; } - @Nullable - private Url getExistingParent(Url url) throws SvnBindException { + private @Nullable Url getExistingParent(Url url) throws SvnBindException { while (url != null && !url.equals(myRepositoryUrl) && !existsInRevision(url, myEndNumber)) { url = SvnUtil.removePathTail(url); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LoadedRevisionsCache.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LoadedRevisionsCache.java index 1de588fd01a5..d1ad0034713c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LoadedRevisionsCache.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LoadedRevisionsCache.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.Disposable; @@ -72,8 +72,7 @@ public final class LoadedRevisionsCache implements Disposable { myMap.clear(); } - @NotNull - private static List> split(final List list, final int size) { + private static @NotNull List> split(final List list, final int size) { final int listSize = list.size(); if (listSize < size) { return Collections.singletonList(list); @@ -91,8 +90,7 @@ public final class LoadedRevisionsCache implements Disposable { return result; } - @Nullable - public Bunch put(final List data, final boolean consistentWithPrevious, final Bunch bindTo) { + public @Nullable Bunch put(final List data, final boolean consistentWithPrevious, final Bunch bindTo) { if (data.isEmpty()) { return null; } @@ -127,8 +125,7 @@ public final class LoadedRevisionsCache implements Disposable { return bindToBunch; } - @Nullable - public Iterator iterator(final String location) { + public @Nullable Iterator iterator(final String location) { final Bunch bunch = myMap.get(location); if (bunch == null) { return null; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java index 39c6c20d4c18..4c624b3f3800 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/LogEntryPath.java @@ -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 org.jetbrains.idea.svn.history; import org.jetbrains.annotations.NotNull; @@ -65,38 +65,32 @@ public class LogEntryPath extends BaseNodeDescription { return path; } - @NotNull - public Builder setKind(@NotNull NodeKind kind) { + public @NotNull Builder setKind(@NotNull NodeKind kind) { this.kind = kind; return this; } - @NotNull - public Builder setType(char type) { + public @NotNull Builder setType(char type) { this.action = String.valueOf(type); return this; } - @NotNull - public Builder setCopyFromPath(String copyFromPath) { + public @NotNull Builder setCopyFromPath(String copyFromPath) { this.copyFromPath = copyFromPath; return this; } - @NotNull - public Builder setCopyFromRevision(long copyFromRevision) { + public @NotNull Builder setCopyFromRevision(long copyFromRevision) { this.copyFromRevision = copyFromRevision; return this; } - @NotNull - public Builder setPath(String path) { + public @NotNull Builder setPath(String path) { this.path = path; return this; } - @NotNull - public LogEntryPath build() { + public @NotNull LogEntryPath build() { return new LogEntryPath(this); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java index 53eb201993fa..416608933be3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeInfoUpdatesListener.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.application.ApplicationManager; @@ -19,7 +19,7 @@ import static com.intellij.openapi.vcs.ProjectLevelVcsManager.VCS_CONFIGURATION_ import static com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener.BRANCHES_CHANGED; public class MergeInfoUpdatesListener { - private final static int DELAY = 300; + private static final int DELAY = 300; private final Project myProject; private final MessageBusConnection myConnection; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java index 34e185095393..db475c07bf2e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/MergeSourceHierarchyBuilder.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.history; import com.intellij.openapi.util.Pair; @@ -26,7 +12,7 @@ import java.util.List; public class MergeSourceHierarchyBuilder implements ThrowableConsumer, SvnBindException> { private LogHierarchyNode myCurrentHierarchy; - @NotNull private final Consumer myConsumer; + private final @NotNull Consumer myConsumer; public MergeSourceHierarchyBuilder(@NotNull Consumer consumer) { myConsumer = consumer; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java index 4097cd3ba3e4..78b4bd97daca 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.CommonBundle; @@ -54,8 +54,8 @@ import static org.jetbrains.idea.svn.SvnBundle.messagePointer; public class RootsAndBranches implements CommittedChangeListDecorator { private static final Logger LOG = Logger.getInstance(RootsAndBranches.class); - @NotNull private final SvnVcs myVcs; - @NotNull private final Project myProject; + private final @NotNull SvnVcs myVcs; + private final @NotNull Project myProject; private final DecoratorManager myManager; private final RepositoryLocation myLocation; private JPanel myPanel; @@ -64,7 +64,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { private boolean myHighlightingOn; private JPanel myPanelWrapper; - @NotNull private final MergePanelFiltering myStrategy; + private final @NotNull MergePanelFiltering myStrategy; private final CommonFilter myFilterMerged = new CommonFilter(messagePointer("tab.repository.merge.panel.filter.plus")); private final CommonFilter myFilterNotMerged = new CommonFilter(messagePointer("tab.repository.merge.panel.filter.minus")); private final CommonFilter myFilterAlien = new CommonFilter(messagePointer("tab.repository.merge.panel.filter.others")); @@ -183,7 +183,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { final Task.Backgroundable backgroundable = new Task.Backgroundable(myProject, message("progress.title.loading.working.copies.data"), false) { @Override - public void run(@NotNull final ProgressIndicator indicator) { + public void run(final @NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); final Map panels = new HashMap<>(); final Map holders = new HashMap<>(); @@ -310,8 +310,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { return svnGroup; } - @NotNull - private MergeInfoHolder createHolder(@NotNull SvnMergeInfoRootPanelManual panel) { + private @NotNull MergeInfoHolder createHolder(@NotNull SvnMergeInfoRootPanelManual panel) { return new MergeInfoHolder(myProject, myManager, this, panel); } @@ -393,7 +392,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { for (MergeInfoHolder holder : myHolders.values()) { if (holder.refreshEnabled(false)) { e.getPresentation().setEnabled(true); @@ -404,7 +403,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabled(false); @@ -427,12 +426,12 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - public boolean isSelected(@NotNull final AnActionEvent e) { + public boolean isSelected(final @NotNull AnActionEvent e) { return myHighlightingOn; } @Override - public void setSelected(@NotNull final AnActionEvent e, final boolean state) { + public void setSelected(final @NotNull AnActionEvent e, final boolean state) { if (state) { turnFromHereHighlighting(); } @@ -455,18 +454,18 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { super.update(e); e.getPresentation().setEnabled(myHighlightingOn); } @Override - public boolean isSelected(@NotNull final AnActionEvent e) { + public boolean isSelected(final @NotNull AnActionEvent e) { return mySelected; } @Override - public void setSelected(@NotNull final AnActionEvent e, final boolean state) { + public void setSelected(final @NotNull AnActionEvent e, final boolean state) { mySelected = state; myStrategy.notifyListener(); } @@ -517,14 +516,12 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - @NotNull - protected MergerFactory createMergerFactory(SelectedChangeListsChecker checker) { + protected @NotNull MergerFactory createMergerFactory(SelectedChangeListsChecker checker) { return new ChangeListsMergerFactory(checker.getSelectedLists(), true, !myMarkAsMerged, false); } @Override - @NotNull - protected SelectedChangeListsChecker createChecker() { + protected @NotNull SelectedChangeListsChecker createChecker() { return new SelectedChangeListsChecker(); } @@ -537,17 +534,15 @@ public class RootsAndBranches implements CommittedChangeListDecorator { presentation.setEnabled(presentation.isEnabled() && mergeEnabled(checker.getSelectedLists(), myMarkAsMerged)); } - @Nullable @Override - protected Url getSelectedBranchUrl(SelectedCommittedStuffChecker checker) { + protected @Nullable Url getSelectedBranchUrl(SelectedCommittedStuffChecker checker) { SvnMergeInfoRootPanelManual data = getPanelData(checker.getSelectedLists()); return data != null && data.getBranch() != null ? data.getBranch().getUrl() : null; } @Override - @Nullable - protected String getSelectedBranchLocalPath(SelectedCommittedStuffChecker checker) { + protected @Nullable String getSelectedBranchLocalPath(SelectedCommittedStuffChecker checker) { final SvnMergeInfoRootPanelManual data = getPanelData(checker.getSelectedLists()); if (data != null) { return data.getLocalBranch(); @@ -570,14 +565,12 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - @NotNull - protected MergerFactory createMergerFactory(final SelectedChangeListsChecker checker) { + protected @NotNull MergerFactory createMergerFactory(final SelectedChangeListsChecker checker) { return new ChangeListsMergerFactory(checker.getSelectedLists(), false, !myIntegrate, false); } @Override - @NotNull - protected SelectedChangeListsChecker createChecker() { + protected @NotNull SelectedChangeListsChecker createChecker() { return new SelectedChangeListsChecker(); } @@ -593,9 +586,8 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } } - @Nullable @Override - protected Url getSelectedBranchUrl(SelectedCommittedStuffChecker checker) { + protected @Nullable Url getSelectedBranchUrl(SelectedCommittedStuffChecker checker) { SvnMergeInfoRootPanelManual data = getPanelData(checker.getSelectedLists()); return data != null && data.getBranch() != null ? data.getBranch().getUrl() : null; @@ -630,8 +622,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { return null; } - @Nullable - public ListMergeStatus getStatus(final CommittedChangeList list, final boolean ignoreEnabled) { + public @Nullable ListMergeStatus getStatus(final CommittedChangeList list, final boolean ignoreEnabled) { if (!(list instanceof SvnChangeList svnList)) { return null; } @@ -655,8 +646,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { return null; } - @NotNull - public MergePanelFiltering getStrategy() { + public @NotNull MergePanelFiltering getStrategy() { return myStrategy; } @@ -686,9 +676,8 @@ public class RootsAndBranches implements CommittedChangeListDecorator { return myPanel; } - @NotNull @Override - public CommittedChangesFilterKey getKey() { + public @NotNull CommittedChangesFilterKey getKey() { return new CommittedChangesFilterKey("MERGE_PANEL", CommittedChangesFilterPriority.MERGE); } @@ -715,8 +704,7 @@ public class RootsAndBranches implements CommittedChangeListDecorator { } @Override - @NotNull - public List filterChangeLists(@NotNull List changeLists) { + public @NotNull List filterChangeLists(@NotNull List changeLists) { if ((!myFilterAlien.mySelected) && (!myFilterNotMerged.mySelected) && (!myFilterMerged.mySelected)) { return new ArrayList<>(changeLists); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/ShowHideMergePanelAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/ShowHideMergePanelAction.java index 73be260348cb..99bb753e2413 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/ShowHideMergePanelAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/ShowHideMergePanelAction.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.actionSystem.ActionUpdateThread; @@ -13,8 +13,8 @@ import static org.jetbrains.idea.svn.SvnBundle.messagePointer; public class ShowHideMergePanelAction extends DumbAwareToggleAction { - @NotNull private final DecoratorManager myManager; - @NotNull private final ChangeListFilteringStrategy myStrategy; + private final @NotNull DecoratorManager myManager; + private final @NotNull ChangeListFilteringStrategy myStrategy; private boolean myIsSelected; public ShowHideMergePanelAction(@NotNull DecoratorManager manager, @NotNull ChangeListFilteringStrategy strategy) { @@ -33,12 +33,12 @@ public class ShowHideMergePanelAction extends DumbAwareToggleAction { } @Override - public boolean isSelected(@NotNull final AnActionEvent e) { + public boolean isSelected(final @NotNull AnActionEvent e) { return myIsSelected; } @Override - public void setSelected(@NotNull final AnActionEvent e, final boolean state) { + public void setSelected(final @NotNull AnActionEvent e, final boolean state) { myIsSelected = state; if (state) { myManager.setFilteringStrategy(myStrategy); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java index f7f9438befe9..d6884d0cbe73 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SingleCommittedListProvider.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.diagnostic.Logger; @@ -29,10 +29,10 @@ public class SingleCommittedListProvider { private static final Logger LOG = Logger.getInstance(SingleCommittedListProvider.class); - @NotNull private final SvnVcs myVcs; - @NotNull private final Project myProject; - @NotNull private final VirtualFile file; - @NotNull private final VcsRevisionNumber number; + private final @NotNull SvnVcs myVcs; + private final @NotNull Project myProject; + private final @NotNull VirtualFile file; + private final @NotNull VcsRevisionNumber number; private SvnChangeList[] changeList; private Revision revisionBefore; private Url repositoryUrl; @@ -127,8 +127,7 @@ public class SingleCommittedListProvider { return path == null ? filePath : path; } - @NotNull - private SvnChangeList createChangeList(@NotNull LogEntry logEntry) { + private @NotNull SvnChangeList createChangeList(@NotNull LogEntry logEntry) { return new SvnChangeList(myVcs, svnRootLocation, logEntry, repositoryUrl); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java index d60c76c2ffcd..971ef82e4906 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java @@ -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 org.jetbrains.idea.svn.history; @@ -65,7 +65,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar private final CommonPathSearcher myCommonPathSearcher; private final Set myKnownAsDirectories; - public SvnChangeList(@NotNull final List lists, @NotNull final SvnRepositoryLocation location) { + public SvnChangeList(final @NotNull List lists, final @NotNull SvnRepositoryLocation location) { final SvnChangeList sample = (SvnChangeList) lists.get(0); myVcs = sample.myVcs; @@ -154,14 +154,12 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar } @Override - @Nullable - public Date getCommitDate() { + public @Nullable Date getCommitDate() { return myDate; } - @Nullable @Override - public VcsRevisionNumber getRevisionNumber() { + public @Nullable VcsRevisionNumber getRevisionNumber() { return myRevisionNumber; } @@ -282,8 +280,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar } } - @Nullable - private FilePath getLocalPath(@NotNull String path, final NotNullFunction detector) { + private @Nullable FilePath getLocalPath(@NotNull String path, final NotNullFunction detector) { if (myVcs.getProject().isDefault()) return null; Url absoluteUrl = parseUrl(myRepositoryRoot + path, false); @@ -333,8 +330,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar return myPathToChangeMapping.get(path); } - @Nullable - private FilePath localDeletedPath(@NotNull Url url, final boolean isDir) { + private @Nullable FilePath localDeletedPath(@NotNull Url url, final boolean isDir) { final SvnFileUrlMapping urlMapping = myVcs.getSvnFileUrlMapping(); final File file = urlMapping.getLocalPath(url); if (file != null) { @@ -410,8 +406,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar myWithoutDirStatus.clear(); } - @Nullable - private SvnRepositoryContentRevision createRevision(final SvnRepositoryContentRevision previousRevision, final boolean isDir) { + private @Nullable SvnRepositoryContentRevision createRevision(final SvnRepositoryContentRevision previousRevision, final boolean isDir) { return previousRevision == null ? null : SvnRepositoryContentRevision.create(myVcs, previousRevision.getFullPath(), VcsUtil.getFilePath(previousRevision.getFile().getPath(), isDir), @@ -466,15 +461,13 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar } } - @NotNull - private String getRelativePath(@NotNull ContentRevision revision) { + private @NotNull String getRelativePath(@NotNull ContentRevision revision) { return ((SvnRepositoryContentRevision)revision).getRelativePath(myRepositoryRoot); } - @NotNull - private Collection getChildrenAsChanges(@NotNull ContentRevision contentRevision, - final boolean isBefore, - @NotNull final Set> duplicates) + private @NotNull Collection getChildrenAsChanges(@NotNull ContentRevision contentRevision, + final boolean isBefore, + final @NotNull Set> duplicates) throws VcsException { final List result = new ArrayList<>(); @@ -543,10 +536,9 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar change.addAdditionalLayerElement(SvnChangeProvider.PROPERTY_LAYER, additional); } - @Nullable - private SvnLazyPropertyContentRevision createPropertyRevision(@NotNull FilePath filePath, - @Nullable ContentRevision revision, - @NotNull Url url) { + private @Nullable SvnLazyPropertyContentRevision createPropertyRevision(@NotNull FilePath filePath, + @Nullable ContentRevision revision, + @NotNull Url url) { if (revision == null) return null; SvnRevisionNumber number = (SvnRevisionNumber)revision.getRevisionNumber(); @@ -555,8 +547,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return myMessage; } @@ -719,15 +710,13 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar return myBranchUrl; } - @Nullable - public VirtualFile getVcsRoot() { + public @Nullable VirtualFile getVcsRoot() { ensureCacheUpdated(); return myWcRoot == null ? null : myWcRoot.getRoot(); } - @Nullable - public VirtualFile getRoot() { + public @Nullable VirtualFile getRoot() { ensureCacheUpdated(); return myWcRoot == null ? null : myWcRoot.getVirtualFile(); @@ -799,13 +788,11 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar myWcRoot = null; } - @NotNull - public Set getAffectedPaths() { + public @NotNull Set getAffectedPaths() { return ContainerUtil.newHashSet(ContainerUtil.concat(myAddedPaths, myDeletedPaths, myChangedPaths)); } - @Nullable - public String getWcPath() { + public @Nullable String getWcPath() { final RootUrlInfo rootInfo = getWcRootInfo(); return rootInfo == null ? null : rootInfo.getIoFile().getAbsolutePath(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java index 9404c11becb9..fa975998f115 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java @@ -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 org.jetbrains.idea.svn.history; @@ -50,15 +50,15 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnCommittedChangesProvider implements CachingCommittedChangesProvider { - private final static Logger LOG = Logger.getInstance(SvnCommittedChangesProvider.class); + private static final Logger LOG = Logger.getInstance(SvnCommittedChangesProvider.class); - @NotNull private final SvnVcs myVcs; - @NotNull private final MessageBusConnection myConnection; + private final @NotNull SvnVcs myVcs; + private final @NotNull MessageBusConnection myConnection; private MergeInfoUpdatesListener myMergeInfoUpdatesListener; - @NotNull private final SvnCommittedListsZipper myZipper; + private final @NotNull SvnCommittedListsZipper myZipper; - public final static int VERSION_WITH_COPY_PATHS_ADDED = 2; - public final static int VERSION_WITH_REPLACED_PATHS = 3; + public static final int VERSION_WITH_COPY_PATHS_ADDED = 2; + public static final int VERSION_WITH_REPLACED_PATHS = 3; public SvnCommittedChangesProvider(@NotNull SvnVcs vcs) { myVcs = vcs; @@ -74,22 +74,19 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } @Override - @NotNull - public ChangesBrowserSettingsEditor createFilterUI(boolean showDateFilter) { + public @NotNull ChangesBrowserSettingsEditor createFilterUI(boolean showDateFilter) { return new SvnVersionFilterComponent(showDateFilter); } @Override - @Nullable - public RepositoryLocation getLocationFor(@NotNull FilePath root) { + public @Nullable RepositoryLocation getLocationFor(@NotNull FilePath root) { Info info = myVcs.getInfo(root.getIOFile()); return info != null && info.getUrl() != null ? new SvnRepositoryLocation(info.getUrl(), info.getRepositoryRootUrl(), root) : null; } @Override - @NotNull - public VcsCommittedListsZipper getZipper() { + public @NotNull VcsCommittedListsZipper getZipper() { return myZipper; } @@ -118,10 +115,9 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } @Override - @NotNull - public List getCommittedChanges(@NotNull ChangeBrowserSettings settings, - @NotNull RepositoryLocation location, - int maxCount) throws VcsException { + public @NotNull List getCommittedChanges(@NotNull ChangeBrowserSettings settings, + @NotNull RepositoryLocation location, + int maxCount) throws VcsException { SvnRepositoryLocation svnLocation = (SvnRepositoryLocation)location; List result = new ArrayList<>(); Url repositoryRoot = getRepositoryRoot(svnLocation); @@ -150,8 +146,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi builder.finish(); } - @NotNull - private Url getRepositoryRoot(@NotNull SvnRepositoryLocation svnLocation) throws VcsException { + private @NotNull Url getRepositoryRoot(@NotNull SvnRepositoryLocation svnLocation) throws VcsException { // TODO: Additionally SvnRepositoryLocation could possibly be refactored to always contain FilePath (or similar local item) // TODO: So here we could get repository url without performing remote svn command @@ -183,18 +178,15 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi createLogHandler(resultConsumer, filterOutByDate, author)); } - @NotNull - private static Revision createBeforeRevision(@NotNull ChangeBrowserSettings settings) { + private static @NotNull Revision createBeforeRevision(@NotNull ChangeBrowserSettings settings) { return createRevision(settings.getDateBeforeFilter(), settings.getChangeBeforeFilter(), Revision.HEAD); } - @NotNull - private static Revision createAfterRevision(@NotNull ChangeBrowserSettings settings) { + private static @NotNull Revision createAfterRevision(@NotNull ChangeBrowserSettings settings) { return createRevision(settings.getDateAfterFilter(), settings.getChangeAfterFilter(), Revision.of(1)); } - @NotNull - private static Revision createRevision(@Nullable Date date, @Nullable Long change, @NotNull Revision defaultValue) { + private static @NotNull Revision createRevision(@Nullable Date date, @Nullable Long change, @NotNull Revision defaultValue) { Revision result; if (date != null) { @@ -210,10 +202,9 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi return result; } - @NotNull - private LogEntryConsumer createLogHandler(@NotNull ThrowableConsumer resultConsumer, - boolean filterOutByDate, - @Nullable String author) { + private @NotNull LogEntryConsumer createLogHandler(@NotNull ThrowableConsumer resultConsumer, + boolean filterOutByDate, + @Nullable String author) { return logEntry -> { if (myVcs.getProject().isDisposed()) throw new ProcessCanceledException(); @@ -246,8 +237,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } @Override - @NotNull - public VcsCommittedViewAuxiliary createActions(@NotNull DecoratorManager manager, @Nullable RepositoryLocation location) { + public @NotNull VcsCommittedViewAuxiliary createActions(@NotNull DecoratorManager manager, @Nullable RepositoryLocation location) { RootsAndBranches rootsAndBranches = new RootsAndBranches(myVcs, manager, location); refreshMergeInfo(rootsAndBranches); @@ -271,15 +261,13 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi return 0; } - @Nullable @Override - public Pair getOneList(@NotNull VirtualFile file, @NotNull VcsRevisionNumber number) throws VcsException { + public @Nullable Pair getOneList(@NotNull VirtualFile file, @NotNull VcsRevisionNumber number) throws VcsException { return new SingleCommittedListProvider(myVcs, file, number).run(); } - @NotNull @Override - public RepositoryLocation getForNonLocal(@NotNull VirtualFile file) { + public @NotNull RepositoryLocation getForNonLocal(@NotNull VirtualFile file) { return new SvnRepositoryLocation(FileUtil.toSystemIndependentName(file.getPresentableUrl())); } @@ -294,16 +282,14 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } @Override - @NotNull - public SvnChangeList readChangeList(@NotNull RepositoryLocation location, @NotNull DataInput stream) throws IOException { + public @NotNull SvnChangeList readChangeList(@NotNull RepositoryLocation location, @NotNull DataInput stream) throws IOException { int version = getFormatVersion(); return new SvnChangeList(myVcs, (SvnRepositoryLocation)location, stream, VERSION_WITH_COPY_PATHS_ADDED <= version, VERSION_WITH_REPLACED_PATHS <= version); } @Override - @Nullable - public Collection getIncomingFiles(@NotNull RepositoryLocation location) throws VcsException { + public @Nullable Collection getIncomingFiles(@NotNull RepositoryLocation location) throws VcsException { FilePath root = null; if (Registry.is("svn.use.incoming.optimization")) { @@ -317,8 +303,7 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi return root != null ? getIncomingFiles(root) : null; } - @NotNull - private Collection getIncomingFiles(@NotNull FilePath root) throws SvnBindException { + private @NotNull Collection getIncomingFiles(@NotNull FilePath root) throws SvnBindException { // TODO: "svn diff -r BASE:HEAD --xml --summarize" command is also suitable here and outputs only necessary changed files, // TODO: while "svn status -u" also outputs other files which could be not modified on server. But for svn 1.7 "--xml --summarize" // TODO: could only be used with url targets - so we could not use "svn diff" here now for all cases (we could not use url with diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedListsZipper.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedListsZipper.java index 7dab7481cfce..c099eddf846a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedListsZipper.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedListsZipper.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.diagnostic.Logger; @@ -22,15 +22,14 @@ public class SvnCommittedListsZipper implements VcsCommittedListsZipper { private static final Logger LOG = Logger.getInstance(SvnCommittedListsZipper.class); - @NotNull private final SvnVcs myVcs; + private final @NotNull SvnVcs myVcs; public SvnCommittedListsZipper(@NotNull SvnVcs vcs) { myVcs = vcs; } - @NotNull @Override - public Pair, List> groupLocations(@NotNull List in) { + public @NotNull Pair, List> groupLocations(@NotNull List in) { final List groups = new ArrayList<>(); final List singles = new ArrayList<>(); @@ -64,9 +63,8 @@ public class SvnCommittedListsZipper implements VcsCommittedListsZipper { return Pair.create(groups, singles); } - @NotNull @Override - public CommittedChangeList zip(@NotNull RepositoryLocationGroup group, @NotNull List lists) { + public @NotNull CommittedChangeList zip(@NotNull RepositoryLocationGroup group, @NotNull List lists) { return new SvnChangeList(lists, new SvnRepositoryLocation(group.toPresentableString())); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java index a8bf1fe3d9af..b0a859ab205d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCopyPathTracker.java @@ -1,4 +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 org.jetbrains.idea.svn.history; import com.intellij.openapi.diagnostic.Logger; @@ -19,8 +19,8 @@ public class SvnCopyPathTracker { private static final Logger LOG = Logger.getInstance(SvnCopyPathTracker.class); - @NotNull private String myCurrentPath; - @NotNull private final Url myRepositoryUrl; + private @NotNull String myCurrentPath; + private final @NotNull Url myRepositoryUrl; private boolean myHadChanged; public SvnCopyPathTracker(@NotNull Url repositoryUrl, @NotNull String repositoryRelativeUrl) { @@ -45,8 +45,7 @@ public class SvnCopyPathTracker { } } - @Nullable - public FilePath getFilePath(@NotNull SvnVcs vcs) throws SvnBindException { + public @Nullable FilePath getFilePath(@NotNull SvnVcs vcs) throws SvnBindException { if (!myHadChanged) return null; Url currentUrl = append(myRepositoryUrl, myCurrentPath); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnDiffFromHistoryHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnDiffFromHistoryHandler.java index 6efb35e0a122..b14639e7fbe2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnDiffFromHistoryHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnDiffFromHistoryHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.FilePath; @@ -32,16 +18,15 @@ import java.util.List; public class SvnDiffFromHistoryHandler extends BaseDiffFromHistoryHandler { - @NotNull private final SvnVcs myVcs; + private final @NotNull SvnVcs myVcs; public SvnDiffFromHistoryHandler(@NotNull SvnVcs vcs) { super(vcs.getProject()); myVcs = vcs; } - @NotNull @Override - protected List getChangesBetweenRevisions(@NotNull FilePath path, @NotNull SvnFileRevision rev1, @Nullable SvnFileRevision rev2) + protected @NotNull List getChangesBetweenRevisions(@NotNull FilePath path, @NotNull SvnFileRevision rev1, @Nullable SvnFileRevision rev2) throws VcsException { File file = path.getIOFile(); Target target1 = Target.on(rev1.getURL(), rev1.getRevision()); @@ -50,9 +35,8 @@ public class SvnDiffFromHistoryHandler extends BaseDiffFromHistoryHandler getAffectedChanges(@NotNull FilePath path, @NotNull SvnFileRevision rev) throws VcsException { + protected @NotNull List getAffectedChanges(@NotNull FilePath path, @NotNull SvnFileRevision rev) throws VcsException { // Diff with zero revision is used here to get just affected changes under the path, and not all affected changes of the revision. Target target1 = Target.on(rev.getURL(), Revision.of(0)); Target target2 = Target.on(rev.getURL(), rev.getRevision()); @@ -60,14 +44,12 @@ public class SvnDiffFromHistoryHandler extends BaseDiffFromHistoryHandler executeDiff(@NotNull FilePath path, @NotNull Target target1, @NotNull Target target2) throws VcsException { + private @NotNull List executeDiff(@NotNull FilePath path, @NotNull Target target1, @NotNull Target target2) throws VcsException { File file = path.getIOFile(); ClientFactory factory = target2.isUrl() ? myVcs.getFactory(file) : DirectoryWithBranchComparer.getClientFactory(myVcs, file); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnEditCommitMessageDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnEditCommitMessageDialog.java index c2004f6c969e..128778fdbe0e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnEditCommitMessageDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnEditCommitMessageDialog.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.history; import com.intellij.openapi.project.Project; @@ -28,7 +14,7 @@ import javax.swing.*; import java.awt.*; public class SvnEditCommitMessageDialog extends DialogWrapper { - @Nullable private final Project myProject; + private final @Nullable Project myProject; private final String myOldText; private CommitMessage myCommitMessage; @@ -40,9 +26,8 @@ public class SvnEditCommitMessageDialog extends DialogWrapper { init(); } - @Nullable @Override - protected JComponent createCenterPanel() { + protected @Nullable JComponent createCenterPanel() { JPanel parentPanel = new JPanel(new BorderLayout()); final JPanel labelPanel = new JPanel(new GridBagLayout()); final JLabel label1 = new JLabel(SvnBundle.message("svn.edit.commit.message.attention")); @@ -66,20 +51,17 @@ public class SvnEditCommitMessageDialog extends DialogWrapper { return parentPanel; } - @Nullable @Override - public JComponent getPreferredFocusedComponent() { + public @Nullable JComponent getPreferredFocusedComponent() { return myCommitMessage.getEditorField(); } - @NotNull - public String getMessage() { + public @NotNull String getMessage() { return myCommitMessage.getComment(); } - @Nullable @Override - protected String getDimensionServiceKey() { + protected @Nullable String getDimensionServiceKey() { return "org.jetbrains.idea.svn.history.SvnEditCommitMessageDialog"; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java index dc4f223fd7e0..0634311b3174 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnFileRevision.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.application.ApplicationManager; @@ -27,17 +27,17 @@ import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnUtil.getFileContents; public class SvnFileRevision implements VcsFileRevision { - private final static Logger LOG = Logger.getInstance(SvnFileRevision.class); + private static final Logger LOG = Logger.getInstance(SvnFileRevision.class); private final Date myDate; private String myCommitMessage; private final String myAuthor; - @NotNull private final SvnRevisionNumber myRevisionNumber; - @NotNull private final SvnVcs myVCS; - @NotNull private final Url myURL; + private final @NotNull SvnRevisionNumber myRevisionNumber; + private final @NotNull SvnVcs myVCS; + private final @NotNull Url myURL; private final Revision myPegRevision; private final String myCopyFromPath; - @NotNull private final List myMergeSources = new ArrayList<>(); + private final @NotNull List myMergeSources = new ArrayList<>(); public SvnFileRevision(@NotNull SvnVcs vcs, Revision pegRevision, @@ -72,13 +72,11 @@ public class SvnFileRevision implements VcsFileRevision { myURL = url; } - @NotNull - public CommitInfo getCommitInfo() { + public @NotNull CommitInfo getCommitInfo() { return new CommitInfo.Builder(myRevisionNumber.getRevision().getNumber(), myDate, myAuthor).build(); } - @NotNull - public Url getURL() { + public @NotNull Url getURL() { return myURL; } @@ -87,8 +85,7 @@ public class SvnFileRevision implements VcsFileRevision { } @Override - @NotNull - public SvnRevisionNumber getRevisionNumber() { + public @NotNull SvnRevisionNumber getRevisionNumber() { return myRevisionNumber; } @@ -97,9 +94,8 @@ public class SvnFileRevision implements VcsFileRevision { return null; } - @Nullable @Override - public SvnRepositoryLocation getChangedRepositoryPath() { + public @Nullable SvnRepositoryLocation getChangedRepositoryPath() { return new SvnRepositoryLocation(myURL); } @@ -122,8 +118,7 @@ public class SvnFileRevision implements VcsFileRevision { myMergeSources.add(source); } - @NotNull - public List getMergeSources() { + public @NotNull List getMergeSources() { return myMergeSources; } @@ -206,8 +201,7 @@ public class SvnFileRevision implements VcsFileRevision { } } - @NotNull - public Revision getRevision() { + public @NotNull Revision getRevision() { return myRevisionNumber.getRevision(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java index 016de6ee44b3..64e93f9bad57 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java @@ -47,8 +47,9 @@ import java.awt.event.MouseEvent; import java.util.Collections; import java.util.Date; import java.util.List; -import static com.intellij.openapi.util.text.StringUtil.join; + import static com.intellij.openapi.util.text.StringUtil.ELLIPSIS; +import static com.intellij.openapi.util.text.StringUtil.join; import static com.intellij.ui.ScrollPaneFactory.createScrollPane; import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnUtil.*; @@ -170,8 +171,7 @@ public class SvnHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto } @Override - @Nullable - public VcsHistorySession createSessionFor(final FilePath filePath) throws VcsException { + public @Nullable VcsHistorySession createSessionFor(final FilePath filePath) throws VcsException { final VcsAppendableHistoryPartnerAdapter adapter = new VcsAppendableHistoryPartnerAdapter(); reportAppendableHistory(filePath, adapter); adapter.check(); @@ -190,7 +190,7 @@ public class SvnHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto } public void reportAppendableHistory(FilePath path, final VcsAppendableHistorySessionPartner partner, - @Nullable final Revision from, @Nullable final Revision to, final int limit, + final @Nullable Revision from, final @Nullable Revision to, final int limit, Revision peg, final boolean forceBackwards) throws VcsException { FilePath committedPath = path; Change change = ChangeListManager.getInstance(myVcs.getProject()).getChange(path); @@ -244,7 +244,7 @@ public class SvnHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto logLoader.check(); } - private static abstract class LogLoader { + private abstract static class LogLoader { protected final boolean myShowMergeSources; protected Url myUrl; protected boolean mySupport15; @@ -596,14 +596,13 @@ public class SvnHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto private static final class RevisionMergeSourceInfo { - @NotNull private final VcsFileRevision revision; + private final @NotNull VcsFileRevision revision; private RevisionMergeSourceInfo(@NotNull VcsFileRevision revision) { this.revision = revision; } - @NotNull - public SvnFileRevision getRevision() { + public @NotNull SvnFileRevision getRevision() { return (SvnFileRevision)revision; } @@ -685,8 +684,7 @@ public class SvnHistoryProvider implements VcsHistoryProvider, VcsCacheableHisto return false; } - @Nullable - private static SvnFileRevision getSelectedRevision(final MouseEvent e) { + private static @Nullable SvnFileRevision getSelectedRevision(final MouseEvent e) { JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java index a0c8ac4bda9b..d8948cc097de 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistorySession.java @@ -1,8 +1,11 @@ -// 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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.history.*; +import com.intellij.openapi.vcs.history.VcsAbstractHistorySession; +import com.intellij.openapi.vcs.history.VcsFileRevision; +import com.intellij.openapi.vcs.history.VcsHistorySession; +import com.intellij.openapi.vcs.history.VcsRevisionNumber; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnRevisionNumber; import org.jetbrains.idea.svn.SvnVcs; @@ -19,7 +22,7 @@ public class SvnHistorySession extends VcsAbstractHistorySession { private final boolean myHasLocalSource; public SvnHistorySession(SvnVcs vcs, final List revisions, final FilePath committedPath, final boolean haveMergeSources, - @Nullable final VcsRevisionNumber currentRevision, boolean skipRefreshOnStart, boolean source) { + final @Nullable VcsRevisionNumber currentRevision, boolean skipRefreshOnStart, boolean source) { super(revisions, currentRevision); myVcs = vcs; myCommittedPath = committedPath; @@ -31,8 +34,7 @@ public class SvnHistorySession extends VcsAbstractHistorySession { } @Override - @Nullable - public VcsRevisionNumber calcCurrentRevisionNumber() { + public @Nullable VcsRevisionNumber calcCurrentRevisionNumber() { if (myCommittedPath == null) { return null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java index 46ab90d3a941..c6bd019646cb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLazyPropertyContentRevision.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.application.ApplicationManager; @@ -28,7 +28,7 @@ import java.util.List; import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnLazyPropertyContentRevision extends SvnBaseContentRevision implements PropertyRevision { - private final static String ourPropertiesDelimiter = "\n"; + private static final String ourPropertiesDelimiter = "\n"; private final @NotNull VcsRevisionNumber myNumber; private final @NotNull Target myTarget; @@ -43,9 +43,8 @@ public class SvnLazyPropertyContentRevision extends SvnBaseContentRevision imple myTarget = target; } - @Nullable @Override - public List getProperties() throws VcsException { + public @Nullable List getProperties() throws VcsException { if (myContent == null) { myContent = loadContent(); } @@ -83,14 +82,12 @@ public class SvnLazyPropertyContentRevision extends SvnBaseContentRevision imple return ref.get(); } - @NotNull @Override - public VcsRevisionNumber getRevisionNumber() { + public @NotNull VcsRevisionNumber getRevisionNumber() { return myNumber; } - @NotNull - public static List getPropertyList(@NotNull SvnVcs vcs, @NotNull Target target, @Nullable Revision revision) + public static @NotNull List getPropertyList(@NotNull SvnVcs vcs, @NotNull Target target, @Nullable Revision revision) throws SvnBindException { List lines = new ArrayList<>(); PropertyConsumer propertyHandler = createHandler(revision, lines); @@ -100,8 +97,7 @@ public class SvnLazyPropertyContentRevision extends SvnBaseContentRevision imple return lines; } - @NotNull - private static PropertyConsumer createHandler(Revision revision, @NotNull List lines) { + private static @NotNull PropertyConsumer createHandler(Revision revision, @NotNull List lines) { ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator != null) { indicator.checkCanceled(); @@ -129,8 +125,7 @@ public class SvnLazyPropertyContentRevision extends SvnBaseContentRevision imple }; } - @NotNull - public static String toSortedStringPresentation(@NotNull List lines) { + public static @NotNull String toSortedStringPresentation(@NotNull List lines) { StringBuilder sb = new StringBuilder(); lines.sort(Comparator.comparing(PropertyData::getName)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java index 57000c5b6878..fa7d70a3ab0f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnLogUtil.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.progress.ProcessCanceledException; @@ -43,11 +43,10 @@ public class SvnLogUtil implements SvnLogLoader { return result; } - @NotNull - private LogEntryConsumer createLogHandler(final Revision fromIncluding, - final Revision toIncluding, - final boolean includingYoungest, - final boolean includeOldest, final List result) { + private @NotNull LogEntryConsumer createLogHandler(final Revision fromIncluding, + final Revision toIncluding, + final boolean includingYoungest, + final boolean includeOldest, final List result) { return logEntry -> { if (myProject.isDisposed()) throw new ProcessCanceledException(); final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeInfoRootPanelManual.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeInfoRootPanelManual.java index 4029756eaba3..54d31f3c654b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeInfoRootPanelManual.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeInfoRootPanelManual.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.project.Project; @@ -40,12 +40,12 @@ public class SvnMergeInfoRootPanelManual { private JTextArea myLocalArea; private JTextArea myMixedRevisions; - @NotNull private final Project myProject; - @NotNull private final NotNullFunction myRefresher; - @NotNull private final Runnable myListener; + private final @NotNull Project myProject; + private final @NotNull NotNullFunction myRefresher; + private final @NotNull Runnable myListener; private boolean myOnlyOneRoot; - @NotNull private WCInfoWithBranches myInfo; - @NotNull private final Map myBranchToLocal; + private @NotNull WCInfoWithBranches myInfo; + private final @NotNull Map myBranchToLocal; private WCInfoWithBranches.Branch mySelectedBranch; public SvnMergeInfoRootPanelManual(@NotNull Project project, @@ -175,8 +175,7 @@ public class SvnMergeInfoRootPanelManual { myMixedRevisions.setVisible(value); } - @Nullable - private static String getLocal(@NotNull Url url, @Nullable String localPath) { + private static @Nullable String getLocal(@NotNull Url url, @Nullable String localPath) { String result = null; Set paths = SvnBranchMapperManager.getInstance().get(url); @@ -234,8 +233,7 @@ public class SvnMergeInfoRootPanelManual { myFixedSelectLocal = new FixedSizeButton(20); } - @NotNull - public InfoHolder getInfo() { + public @NotNull InfoHolder getInfo() { return new InfoHolder(mySelectedBranch, getLocalBranch(), myInclude.isSelected()); } @@ -249,8 +247,8 @@ public class SvnMergeInfoRootPanelManual { public static class InfoHolder { - @Nullable private final WCInfoWithBranches.Branch myBranch; - @Nullable private final String myLocal; + private final @Nullable WCInfoWithBranches.Branch myBranch; + private final @Nullable String myLocal; private final boolean myEnabled; public InfoHolder(@Nullable WCInfoWithBranches.Branch branch, @Nullable String local, boolean enabled) { @@ -259,13 +257,11 @@ public class SvnMergeInfoRootPanelManual { myEnabled = enabled; } - @Nullable - public WCInfoWithBranches.Branch getBranch() { + public @Nullable WCInfoWithBranches.Branch getBranch() { return myBranch; } - @Nullable - public String getLocal() { + public @Nullable String getLocal() { return myLocal; } @@ -274,18 +270,15 @@ public class SvnMergeInfoRootPanelManual { } } - @NotNull - public WCInfoWithBranches getWcInfo() { + public @NotNull WCInfoWithBranches getWcInfo() { return myInfo; } - @Nullable - public WCInfoWithBranches.Branch getBranch() { + public @Nullable WCInfoWithBranches.Branch getBranch() { return mySelectedBranch; } - @Nullable - public String getLocalBranch() { + public @Nullable String getLocalBranch() { return mySelectedBranch != null ? myBranchToLocal.get(mySelectedBranch.getUrl()) : null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java index cbc4ca277544..06e831923822 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnMergeSourceDetails.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.application.ModalityState; @@ -77,8 +77,7 @@ public final class SvnMergeSourceDetails extends MasterDetailsComponent { } @Override - @Nls - public String getDisplayName() { + public @Nls String getDisplayName() { return null; } @@ -99,7 +98,7 @@ public final class SvnMergeSourceDetails extends MasterDetailsComponent { } private class MyTreeCellRenderer extends ColoredTreeCellRenderer { - private final static int ourMaxWidth = 100; + private static final int ourMaxWidth = 100; @Override public void customizeCellRenderer(@NotNull JTree tree, @@ -205,8 +204,7 @@ public final class SvnMergeSourceDetails extends MasterDetailsComponent { } @Override - @Nls - public String getDisplayName() { + public @Nls String getDisplayName() { return getBannerSlogan(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java index f50429fcae2f..2d52eb630503 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryContentRevision.java @@ -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 org.jetbrains.idea.svn.history; @@ -28,7 +28,7 @@ import static com.intellij.util.ObjectUtils.notNull; public class SvnRepositoryContentRevision extends SvnBaseContentRevision implements ByteBackedContentRevision { - @NotNull private final String myPath; + private final @NotNull String myPath; private final long myRevision; public SvnRepositoryContentRevision(@NotNull SvnVcs vcs, @NotNull FilePath remotePath, @Nullable FilePath localPath, long revision) { @@ -38,8 +38,7 @@ public class SvnRepositoryContentRevision extends SvnBaseContentRevision impleme } @Override - @NotNull - public String getContent() throws VcsException { + public @NotNull String getContent() throws VcsException { return ContentRevisionCache.getAsString(getContentAsBytes(), myFile, null); } @@ -57,8 +56,7 @@ public class SvnRepositoryContentRevision extends SvnBaseContentRevision impleme } } - @NotNull - protected ByteArrayOutputStream loadContent() throws VcsException { + protected @NotNull ByteArrayOutputStream loadContent() throws VcsException { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ContentLoader loader = new ContentLoader(myPath, buffer, myRevision); if (ApplicationManager.getApplication().isDispatchThread()) { @@ -77,8 +75,7 @@ public class SvnRepositoryContentRevision extends SvnBaseContentRevision impleme } @Override - @NotNull - public SvnRevisionNumber getRevisionNumber() { + public @NotNull SvnRevisionNumber getRevisionNumber() { return new SvnRevisionNumber(Revision.of(myRevision)); } @@ -159,8 +156,7 @@ public class SvnRepositoryContentRevision extends SvnBaseContentRevision impleme } } - @NotNull - public String getFullPath() { + public @NotNull String getFullPath() { return myPath; } @@ -168,13 +164,11 @@ public class SvnRepositoryContentRevision extends SvnBaseContentRevision impleme return SvnUtil.getRelativePath(repositoryUrl, myPath); } - @NotNull - public Url getUrl() throws SvnBindException { + public @NotNull Url getUrl() throws SvnBindException { return SvnUtil.createUrl(getFullPath(), false); } - @NotNull - public Target toTarget() throws SvnBindException { + public @NotNull Target toTarget() throws SvnBindException { return Target.on(getUrl(), getRevisionNumber().getRevision()); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java index d5711d4484b7..1902fa3994b5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocation.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.FilePath; @@ -11,9 +11,9 @@ import org.jetbrains.idea.svn.commandLine.SvnBindException; public final class SvnRepositoryLocation implements RepositoryLocation { private final String myUrlValue; - @Nullable private final Url myUrl; - @Nullable private final Url myRepositoryUrl; - @Nullable private final FilePath myRoot; + private final @Nullable Url myUrl; + private final @Nullable Url myRepositoryUrl; + private final @Nullable FilePath myRoot; public SvnRepositoryLocation(@NotNull String url) { myUrl = null; @@ -52,18 +52,15 @@ public final class SvnRepositoryLocation implements RepositoryLocation { return myUrlValue; } - @Nullable - public FilePath getRoot() { + public @Nullable FilePath getRoot() { return myRoot; } - @Nullable - public Url getRepositoryUrl() { + public @Nullable Url getRepositoryUrl() { return myRepositoryUrl; } - @NotNull - public Url toSvnUrl() throws SvnBindException { + public @NotNull Url toSvnUrl() throws SvnBindException { return myUrl != null ? myUrl : SvnUtil.createUrl(myUrlValue); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocationGroup.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocationGroup.java index 52d63ccca6b6..2666335596cb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocationGroup.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRepositoryLocationGroup.java @@ -1,4 +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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.RepositoryLocation; @@ -11,7 +11,7 @@ import java.util.Collection; public class SvnRepositoryLocationGroup extends RepositoryLocationGroup { private final Url myUrl; - public SvnRepositoryLocationGroup(@NotNull final Url url, final Collection locations) { + public SvnRepositoryLocationGroup(final @NotNull Url url, final Collection locations) { super(url.toString()); myUrl = url; for (RepositoryLocation location : locations) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java index fc814da64b08..3800c56aba08 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnRevisionsNavigationMediator.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.diagnostic.Logger; @@ -25,7 +25,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnRevisionsNavigationMediator implements CommittedChangesNavigation { private static final Logger LOG = Logger.getInstance(SvnRevisionsNavigationMediator.class); - public final static int CHUNK_SIZE = 50; + public static final int CHUNK_SIZE = 50; private final InternallyCachedProvider myInternallyCached; private final VisuallyCachedProvider myVisuallyCached; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnVersionFilterComponent.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnVersionFilterComponent.java index 934130198e32..3d09590dd29a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnVersionFilterComponent.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnVersionFilterComponent.java @@ -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 org.jetbrains.idea.svn.history; import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings; @@ -61,8 +61,7 @@ public class SvnVersionFilterComponent extends StandardVersionFilterComponent 0) { return myAuthorField.getText(); } @@ -86,9 +85,8 @@ public class SvnVersionFilterComponent extends StandardVersionFilterComponent loadRoots() { + public @NotNull List loadRoots() { List result = new ArrayList<>(); for (WCInfo info : myVcs.getAllWcInfos()) { @@ -47,16 +46,14 @@ public class WcInfoLoader { return result; } - @Nullable - public WCInfoWithBranches reloadInfo(@NotNull WCInfoWithBranches info) { + public @Nullable WCInfoWithBranches reloadInfo(@NotNull WCInfoWithBranches info) { File file = info.getRootInfo().getIoFile(); RootUrlInfo rootInfo = myVcs.getSvnFileUrlMapping().getWcRootForFilePath(getFilePath(info.getRootInfo().getVirtualFile())); return rootInfo != null ? createInfo(new WCInfo(rootInfo, SvnUtil.isWorkingCopyRoot(file), SvnUtil.getDepth(myVcs, file))) : null; } - @Nullable - private WCInfoWithBranches createInfo(@NotNull WCInfo info) { + private @Nullable WCInfoWithBranches createInfo(@NotNull WCInfo info) { if (!info.getFormat().supportsMergeInfo()) { return null; } @@ -74,8 +71,7 @@ public class WcInfoLoader { return rootForUrl != null ? createInfoWithBranches(info, rootForUrl) : null; } - @NotNull - private WCInfoWithBranches createInfoWithBranches(@NotNull WCInfo info, @NotNull RootUrlInfo rootUrlInfo) { + private @NotNull WCInfoWithBranches createInfoWithBranches(@NotNull WCInfo info, @NotNull RootUrlInfo rootUrlInfo) { SvnBranchConfigurationNew configuration = SvnBranchConfigurationManager.getInstance(myVcs.getProject()).get(rootUrlInfo.getVirtualFile()); Ref workingCopyBranch = Ref.create(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/IgnoreGroupHelperAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/IgnoreGroupHelperAction.java index b1ac777f881f..0c7137790623 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/IgnoreGroupHelperAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/IgnoreGroupHelperAction.java @@ -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 org.jetbrains.idea.svn.ignore; import com.intellij.openapi.actionSystem.ActionPlaces; @@ -51,15 +37,13 @@ public class IgnoreGroupHelperAction { private IgnoreGroupHelperAction() { } - @Nullable - public static IgnoreGroupHelperAction createFor(@NotNull AnActionEvent e) { + public static @Nullable IgnoreGroupHelperAction createFor(@NotNull AnActionEvent e) { UpdateSession session = e.getUpdateSession(); Optional helper = session.sharedData(KEY, () -> tryCreateFor(e)); return helper.orElse(null); } - @NotNull - private static Optional tryCreateFor(@NotNull AnActionEvent e) { + private static @NotNull Optional tryCreateFor(@NotNull AnActionEvent e) { // TODO: This logic was taken from BasicAction.update(). Probably it'll be more convenient to share these conditions for correctness. Project project = e.getProject(); SvnVcs vcs = project != null ? SvnVcs.getInstance(project) : null; @@ -129,8 +113,7 @@ public class IgnoreGroupHelperAction { return myAllAreIgnored; } - @NotNull - public FileGroupInfo getFileGroupInfo() { + public @NotNull FileGroupInfo getFileGroupInfo() { return myFileGroupInfo; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java index 3d528380a064..34e3f02170ad 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/ignore/SvnPropertyService.java @@ -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 org.jetbrains.idea.svn.ignore; import com.intellij.openapi.util.Ref; @@ -53,8 +53,8 @@ public final class SvnPropertyService { extensionOk.set(checker.extensionOk()); } - private static abstract class IgnorePropertyWorkTemplate { - @NotNull protected final SvnVcs myVcs; + private abstract static class IgnorePropertyWorkTemplate { + protected final @NotNull SvnVcs myVcs; protected final boolean myUseCommonExtension; protected final boolean myCanUseCachedProperty; @@ -220,7 +220,7 @@ public final class SvnPropertyService { } } - private static String getNewPropertyValueForRemove(final Collection data, @NotNull final String propertyValue) { + private static String getNewPropertyValueForRemove(final Collection data, final @NotNull String propertyValue) { final StringBuilder sb = new StringBuilder(); final StringTokenizer st = new StringTokenizer(propertyValue, "\r\n "); while (st.hasMoreElements()) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BaseMergeTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BaseMergeTask.java index 809150109737..b5c735a2ca17 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BaseMergeTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BaseMergeTask.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.progress.ProgressIndicator; @@ -23,9 +9,9 @@ import org.jetbrains.annotations.NotNull; public abstract class BaseMergeTask implements ThrowableRunnable, ThrowableConsumer { - @NotNull protected final QuickMerge myMergeProcess; - @NotNull protected final MergeContext myMergeContext; - @NotNull protected final QuickMergeInteraction myInteraction; + protected final @NotNull QuickMerge myMergeProcess; + protected final @NotNull MergeContext myMergeContext; + protected final @NotNull QuickMergeInteraction myInteraction; public BaseMergeTask(@NotNull QuickMerge mergeProcess) { myMergeProcess = mergeProcess; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BranchMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BranchMerger.java index 799b1f41c274..d009d139e387 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BranchMerger.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/BranchMerger.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.diagnostic.Logger; @@ -84,14 +84,12 @@ public class BranchMerger implements IMerger { } } - @NotNull - private DiffOptions createDiffOptions() { + private @NotNull DiffOptions createDiffOptions() { return myVcs.getSvnConfiguration().getMergeOptions(); } @Override - @Nullable - public String getInfo() { + public @Nullable String getInfo() { return null; } @@ -105,13 +103,11 @@ public class BranchMerger implements IMerger { } @Override - @Nullable - public String getSkipped() { + public @Nullable String getSkipped() { return null; } - @NotNull - public Revision resolveSourceLatestRevision() { + public @NotNull Revision resolveSourceLatestRevision() { Revision result = Revision.HEAD; try { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ByNumberChangeListComparator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ByNumberChangeListComparator.java index 977df0c1e82d..0f337321fc03 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ByNumberChangeListComparator.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ByNumberChangeListComparator.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; @@ -6,7 +6,7 @@ import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import java.util.Comparator; public class ByNumberChangeListComparator implements Comparator { - private final static ByNumberChangeListComparator ourInstance = new ByNumberChangeListComparator(); + private static final ByNumberChangeListComparator ourInstance = new ByNumberChangeListComparator(); public static ByNumberChangeListComparator getInstance() { return ourInstance; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeListsMergerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeListsMergerFactory.java index c794c18a215e..3eec86ad7c15 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeListsMergerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeListsMergerFactory.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; @@ -13,7 +13,7 @@ import java.util.List; public class ChangeListsMergerFactory implements MergerFactory { - @NotNull protected final List myChangeLists; + protected final @NotNull List myChangeLists; private final boolean myRecordOnly; private final boolean myInvertRange; private final boolean myGroupSequentialChangeLists; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeSetMergerFactory.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeSetMergerFactory.java index 02549d079930..4904d0239aab 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeSetMergerFactory.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ChangeSetMergerFactory.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.vcs.changes.Change; @@ -15,8 +15,8 @@ import java.util.List; public class ChangeSetMergerFactory implements MergerFactory { - @NotNull private final CommittedChangeList myChangeList; - @NotNull private final List myChanges; + private final @NotNull CommittedChangeList myChangeList; + private final @NotNull List myChanges; public ChangeSetMergerFactory(@NotNull CommittedChangeList changeList, @NotNull Collection changes) { myChangeList = changeList; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java index 5d331e67f48a..4b45b757a1a0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/GatheringChangelistBuilder.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.diagnostic.Logger; @@ -27,10 +27,10 @@ public class GatheringChangelistBuilder extends EmptyChangelistBuilder { private static final Logger LOG = Logger.getInstance(GatheringChangelistBuilder.class); - @NotNull private final Set myCheckSet; - @NotNull private final List myChanges; - @NotNull private final UpdatedFilesReverseSide myFiles; - @NotNull private final SvnVcs myVcs; + private final @NotNull Set myCheckSet; + private final @NotNull List myChanges; + private final @NotNull UpdatedFilesReverseSide myFiles; + private final @NotNull SvnVcs myVcs; public GatheringChangelistBuilder(@NotNull SvnVcs vcs, @NotNull UpdatedFilesReverseSide files) { myVcs = vcs; @@ -103,8 +103,7 @@ public class GatheringChangelistBuilder extends EmptyChangelistBuilder { return true; } - @NotNull - public List getChanges() { + public @NotNull List getChanges() { return myChanges; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java index b4ae0efcc6fb..8125cccbc4c9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.configurationStore.StoreUtil; @@ -49,7 +49,7 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { private JCheckBox myIgnoreWhitespacesCheckBox; private final Project myProject; - @NotNull private final Url mySelectedBranchUrl; + private final @NotNull Url mySelectedBranchUrl; private final SvnVcs myVcs; private final String mySelectedRepositoryUUID; @@ -106,7 +106,7 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final VirtualFile vFile = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myProject, null); if (vFile != null) { final File file = virtualToIoFile(vFile); @@ -145,14 +145,14 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { } @Override - public void update(@NotNull final AnActionEvent e) { + public void update(final @NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); final int idx = myWorkingCopiesList.getSelectedIndex(); presentation.setEnabled(idx != -1); } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { final int idx = myWorkingCopiesList.getSelectedIndex(); if (idx != -1) { final WorkingCopyInfo info = myWorkingCopyInfoModel.get(idx); @@ -245,21 +245,19 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { } } - @Nullable - private static Url realTargetUrl(@NotNull SvnVcs vcs, @NotNull WorkingCopyInfo info, @NotNull Url targetBranchUrl) { + private static @Nullable Url realTargetUrl(@NotNull SvnVcs vcs, @NotNull WorkingCopyInfo info, @NotNull Url targetBranchUrl) { Info svnInfo = vcs.getInfo(info.getLocalPath()); Url url = svnInfo != null ? svnInfo.getUrl() : null; return url != null && isAncestor(targetBranchUrl, url) ? url : null; } - @Nullable - public static Pair selectWorkingCopy(final Project project, - final Url currentBranch, - @NotNull Url targetBranch, - final boolean showIntegrationParameters, - final String selectedLocalBranchPath, - @DialogTitle @Nullable String dialogTitle) { + public static @Nullable Pair selectWorkingCopy(final Project project, + final Url currentBranch, + @NotNull Url targetBranch, + final boolean showIntegrationParameters, + final String selectedLocalBranchPath, + @DialogTitle @Nullable String dialogTitle) { final IntegratedSelectedOptionsDialog dialog = new IntegratedSelectedOptionsDialog(project, currentBranch, targetBranch); if (!showIntegrationParameters) { dialog.selectWcopyRootOnly(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java index 8dc57aead122..253536582b47 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Intersection.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.vcs.changes.Change; @@ -16,21 +16,19 @@ import static com.intellij.util.containers.ContainerUtil.concat; public class Intersection { - @NotNull private final Map myListComments = new HashMap<>(); - @NotNull private final Map> myChangesByLists = new HashMap<>(); + private final @NotNull Map myListComments = new HashMap<>(); + private final @NotNull Map> myChangesByLists = new HashMap<>(); public void add(@NotNull LocalChangeList list, @NotNull Change change) { myChangesByLists.computeIfAbsent(list.getName(), key -> new ArrayList<>()).add(change); myListComments.put(list.getName(), notNull(list.getComment(), list.getName())); } - @NotNull - public String getComment(@NotNull String listName) { + public @NotNull String getComment(@NotNull String listName) { return myListComments.get(listName); } - @NotNull - public Map> getChangesByLists() { + public @NotNull Map> getChangesByLists() { return myChangesByLists; } @@ -38,8 +36,7 @@ public class Intersection { return myChangesByLists.isEmpty(); } - @NotNull - public List getAllChanges() { + public @NotNull List getAllChanges() { return concat(myChangesByLists.values()); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesAction.java index f41ccd572e31..11e48f109a8b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesAction.java @@ -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 org.jetbrains.idea.svn.integrate; import org.jetbrains.annotations.NotNull; @@ -23,7 +9,7 @@ public enum LocalChangesAction { shelve("Shelve local changes"), inspect("Inspect changes"); - @NotNull private final String myTitle; + private final @NotNull String myTitle; LocalChangesAction(@NotNull String title) { myTitle = title; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesPromptTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesPromptTask.java index 706799a4183d..051551a69444 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesPromptTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LocalChangesPromptTask.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.diagnostic.Logger; @@ -41,8 +41,8 @@ public class LocalChangesPromptTask extends BaseMergeTask { private static final Logger LOG = Logger.getInstance(LocalChangesPromptTask.class); - @Nullable private final List myChangeListsToMerge; - @NotNull private final Runnable myCallback; + private final @Nullable List myChangeListsToMerge; + private final @NotNull Runnable myCallback; public LocalChangesPromptTask(@NotNull QuickMerge mergeProcess, @Nullable List changeListsToMerge, @@ -52,8 +52,7 @@ public class LocalChangesPromptTask extends BaseMergeTask { myCallback = callback; } - @Nullable - private File getLocalPath(@NotNull String repositoryRelativePath) { + private @Nullable File getLocalPath(@NotNull String repositoryRelativePath) { try { Url url = append(myMergeContext.getWcInfo().getRepoUrl(), repositoryRelativePath); @@ -113,16 +112,14 @@ public class LocalChangesPromptTask extends BaseMergeTask { } } - @Nullable - private Intersection getChangesIntersection(@NotNull List localChangeLists, - @NotNull List changeListsToMerge) { + private @Nullable Intersection getChangesIntersection(@NotNull List localChangeLists, + @NotNull List changeListsToMerge) { Set pathsToMerge = collectPaths(changeListsToMerge); return !changeListsToMerge.isEmpty() ? getChangesIntersection(localChangeLists, change -> hasPathToMerge(change, pathsToMerge)) : null; } - @NotNull - private Set collectPaths(@NotNull List lists) { + private @NotNull Set collectPaths(@NotNull List lists) { return lists.stream() .flatMap(list -> list.getAffectedPaths().stream()) .map(this::getLocalPath) @@ -131,13 +128,11 @@ public class LocalChangesPromptTask extends BaseMergeTask { .collect(toSet()); } - @NotNull - private static Intersection getAllChangesIntersection(@NotNull List localChangeLists) { + private static @NotNull Intersection getAllChangesIntersection(@NotNull List localChangeLists) { return getChangesIntersection(localChangeLists, alwaysTrue()); } - @NotNull - private static Intersection getChangesIntersection(@NotNull List changeLists, @NotNull Condition filter) { + private static @NotNull Intersection getChangesIntersection(@NotNull List changeLists, @NotNull Condition filter) { Intersection result = new Intersection(); for (LocalChangeList changeList : changeLists) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LookForBranchOriginTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LookForBranchOriginTask.java index 73578e70048a..46b0d9a4cb89 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LookForBranchOriginTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/LookForBranchOriginTask.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.diagnostic.Logger; @@ -13,7 +13,7 @@ public class LookForBranchOriginTask extends BaseMergeTask { private static final Logger LOG = Logger.getInstance(LookForBranchOriginTask.class); private final boolean myFromSource; - @NotNull private final Consumer myCallback; + private final @NotNull Consumer myCallback; public LookForBranchOriginTask(@NotNull QuickMerge mergeProcess, boolean fromSource, diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java index 94666007dea0..b22a3f65bf5f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeCalculatorTask.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.diagnostic.Logger; @@ -29,12 +29,12 @@ public class MergeCalculatorTask extends BaseMergeTask { private static final Logger LOG = Logger.getInstance(MergeCalculatorTask.class); public static final String PROP_BUNCH_SIZE = "idea.svn.quick.merge.bunch.size"; - private final static int BUNCH_SIZE = 100; + private static final int BUNCH_SIZE = 100; - @Nullable private final SvnBranchPointsCalculator.WrapperInvertor myCopyPoint; - @NotNull private final OneShotMergeInfoHelper myMergeChecker; - @NotNull private final List myChangeLists; - @NotNull private final Consumer myCallback; + private final @Nullable SvnBranchPointsCalculator.WrapperInvertor myCopyPoint; + private final @NotNull OneShotMergeInfoHelper myMergeChecker; + private final @NotNull List myChangeLists; + private final @NotNull Consumer myCallback; private boolean myAllListsLoaded; public MergeCalculatorTask(@NotNull QuickMerge mergeProcess, @@ -54,13 +54,11 @@ public class MergeCalculatorTask extends BaseMergeTask { return myAllListsLoaded; } - @NotNull - public MergeChecker getMergeChecker() { + public @NotNull MergeChecker getMergeChecker() { return myMergeChecker; } - @NotNull - public List getChangeLists() { + public @NotNull List getChangeLists() { return myChangeLists; } @@ -90,8 +88,7 @@ public class MergeCalculatorTask extends BaseMergeTask { } } - @NotNull - private List> getChangeListsAfter(long revision) throws VcsException { + private @NotNull List> getChangeListsAfter(long revision) throws VcsException { ChangeBrowserSettings settings = new ChangeBrowserSettings(); settings.CHANGE_AFTER = Long.toString(revision); settings.USE_CHANGE_AFTER_FILTER = true; @@ -99,8 +96,7 @@ public class MergeCalculatorTask extends BaseMergeTask { return getChangeLists(myMergeContext, settings, revision, -1, Pair::create); } - @NotNull - private List getNotMergedChangeLists(@NotNull List> changeLists) { + private @NotNull List getNotMergedChangeLists(@NotNull List> changeLists) { List result = new ArrayList<>(); progress(message("progress.text.collecting.not.merged.revisions")); @@ -116,8 +112,7 @@ public class MergeCalculatorTask extends BaseMergeTask { return result; } - @NotNull - public static Pair, Boolean> loadChangeLists(@NotNull MergeContext mergeContext, long beforeRevision, int size) + public static @NotNull Pair, Boolean> loadChangeLists(@NotNull MergeContext mergeContext, long beforeRevision, int size) throws VcsException { ChangeBrowserSettings settings = new ChangeBrowserSettings(); if (beforeRevision > 0) { @@ -137,12 +132,11 @@ public class MergeCalculatorTask extends BaseMergeTask { return configuredSize != null ? configuredSize : size > 0 ? size : BUNCH_SIZE; } - @NotNull - private static List getChangeLists(@NotNull MergeContext mergeContext, - @NotNull ChangeBrowserSettings settings, - long revisionToExclude, - int size, - @NotNull PairFunction resultProvider) throws VcsException { + private static @NotNull List getChangeLists(@NotNull MergeContext mergeContext, + @NotNull ChangeBrowserSettings settings, + long revisionToExclude, + int size, + @NotNull PairFunction resultProvider) throws VcsException { List result = new ArrayList<>(); ((SvnCommittedChangesProvider)mergeContext.getVcs().getCommittedChangesProvider()) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeContext.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeContext.java index 900a552fd4ec..a95c8029e814 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeContext.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeContext.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.project.Project; @@ -15,14 +15,14 @@ import static org.jetbrains.idea.svn.SvnUtil.getRelativeUrl; public class MergeContext { - @NotNull private final Project myProject; - @NotNull private final String myBranchName; - @NotNull private final VirtualFile myRoot; - @NotNull private final WCInfo myWcInfo; - @NotNull private final Url mySourceUrl; - @NotNull private final SvnVcs myVcs; - @NotNull private final String myRepositoryRelativeSourcePath; - @NotNull private final String myRepositoryRelativeWorkingCopyPath; + private final @NotNull Project myProject; + private final @NotNull String myBranchName; + private final @NotNull VirtualFile myRoot; + private final @NotNull WCInfo myWcInfo; + private final @NotNull Url mySourceUrl; + private final @NotNull SvnVcs myVcs; + private final @NotNull String myRepositoryRelativeSourcePath; + private final @NotNull String myRepositoryRelativeWorkingCopyPath; public MergeContext(@NotNull SvnVcs vcs, @NotNull Url sourceUrl, @@ -39,49 +39,39 @@ public class MergeContext { myRepositoryRelativeWorkingCopyPath = ensureStartSlash(getRelativeUrl(myWcInfo.getRepoUrl(), myWcInfo.getUrl())); } - @NotNull - public Project getProject() { + public @NotNull Project getProject() { return myProject; } - @NotNull - public String getBranchName() { + public @NotNull String getBranchName() { return myBranchName; } - @NotNull - public VirtualFile getRoot() { + public @NotNull VirtualFile getRoot() { return myRoot; } - @NotNull - public WCInfo getWcInfo() { + public @NotNull WCInfo getWcInfo() { return myWcInfo; } - @NotNull - public Url getSourceUrl() { + public @NotNull Url getSourceUrl() { return mySourceUrl; } - @NotNull - public String getRepositoryRelativeSourcePath() { + public @NotNull String getRepositoryRelativeSourcePath() { return myRepositoryRelativeSourcePath; } - @NotNull - public String getRepositoryRelativeWorkingCopyPath() { + public @NotNull String getRepositoryRelativeWorkingCopyPath() { return myRepositoryRelativeWorkingCopyPath; } - @NotNull - public SvnVcs getVcs() { + public @NotNull SvnVcs getVcs() { return myVcs; } - @DialogTitle - @NotNull - public String getMergeTitle() { + public @DialogTitle @NotNull String getMergeTitle() { return message("dialog.title.merge.from.branch", myBranchName); } } \ No newline at end of file diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeTask.java index 2af0670933b0..dc74c354eee5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MergeTask.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.vcs.changes.ChangeListManager; @@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; public class MergeTask extends BaseMergeTask { - @NotNull private final Runnable myCallback; + private final @NotNull Runnable myCallback; public MergeTask(@NotNull QuickMerge mergeProcess, @NotNull Runnable callback) { super(mergeProcess); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java index b46a03d634e8..ae16b598e199 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/Merger.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.progress.ProgressIndicator; @@ -27,13 +27,13 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class Merger implements IMerger { protected final List myChangeLists; protected final File myTarget; - @Nullable protected final ProgressTracker myHandler; + protected final @Nullable ProgressTracker myHandler; private final ProgressIndicator myProgressIndicator; protected final Url myCurrentBranchUrl; private final @Nls @NotNull StringBuilder myCommitMessage = new StringBuilder(); protected final SvnConfiguration mySvnConfig; private final Project myProject; - @NotNull protected final SvnVcs myVcs; + protected final @NotNull SvnVcs myVcs; private final String myBranchName; private final boolean myRecordOnly; private final boolean myInvertRange; @@ -99,8 +99,7 @@ public class Merger implements IMerger { return myMergeChunk == null ? 0 : myMergeChunk.nextChunkStart(); } - @Nullable - private MergeChunk getNextChunk() { + private @Nullable MergeChunk getNextChunk() { int start = getNextChunkStart(); int size = 0; @@ -142,8 +141,7 @@ public class Merger implements IMerger { } @Override - @Nullable - public String getInfo() { + public @Nullable String getInfo() { if (myMergeChunk == null) return null; return message("label.changelists.merging.faced.problems", @@ -151,8 +149,7 @@ public class Merger implements IMerger { } @Override - @Nullable - public String getSkipped() { + public @Nullable String getSkipped() { List changeLists = myMergeChunk != null ? myMergeChunk.chunkAndAfterLists() : ContainerUtil.emptyList(); if (changeLists.isEmpty()) return null; @@ -169,8 +166,7 @@ public class Merger implements IMerger { } @Override - @Nullable - public File getMergeInfoHolder() { + public @Nullable File getMergeInfoHolder() { return myTarget; } @@ -197,8 +193,7 @@ public class Merger implements IMerger { void event(final List list); } - @NotNull - private CommittedChangeList listAt(int index) { + private @NotNull CommittedChangeList listAt(int index) { return myChangeLists.get(index); } @@ -244,23 +239,19 @@ public class Merger implements IMerger { return myChangeLists.get(end()).getNumber(); } - @NotNull - public List changeLists() { + public @NotNull List changeLists() { return myChangeLists.subList(start(), nextChunkStart()); } - @NotNull - public List chunkAndBeforeLists() { + public @NotNull List chunkAndBeforeLists() { return myChangeLists.subList(0, nextChunkStart()); } - @NotNull - public List chunkAndAfterLists() { + public @NotNull List chunkAndAfterLists() { return ContainerUtil.subList(myChangeLists, start()); } - @NotNull - public RevisionRange revisionRange() { + public @NotNull RevisionRange revisionRange() { Revision startRevision = Revision.of(lowestNumber() - 1); Revision endRevision = Revision.of(highestNumber()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java index da545ad5018d..ee73792c2f78 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/MoreAction.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.CommonBundle; @@ -35,9 +35,8 @@ public abstract class MoreAction extends DumbAwareAction implements CustomCompon myPanel.add(myLabel); } - @NotNull @Override - public JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { + public @NotNull JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) { return myPanel; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java index 64f26095e773..b1afea95139a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/PointMerger.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.vcs.VcsException; @@ -23,7 +23,7 @@ import java.util.List; public class PointMerger extends Merger { - @NotNull private final List mySelectedChanges; + private final @NotNull List mySelectedChanges; public PointMerger(final SvnVcs vcs, @NotNull CommittedChangeList selectedChangeList, @@ -81,13 +81,12 @@ public class PointMerger extends Merger { client.copy(revision.toTarget(), localPath, revision.getRevisionNumber().getRevision(), true, myHandler); } - @NotNull - private File getLocalPath(@NotNull String fullUrl) { + private @NotNull File getLocalPath(@NotNull String fullUrl) { return SvnUtil.fileFromUrl(myTarget, myCurrentBranchUrl.toString(), fullUrl); } private static class ChangesComparator implements Comparator { - private final static ChangesComparator ourInstance = new ChangesComparator(); + private static final ChangesComparator ourInstance = new ChangesComparator(); public static ChangesComparator getInstance() { return ourInstance; @@ -114,9 +113,8 @@ public class PointMerger extends Merger { } } - @Nullable @Override - public File getMergeInfoHolder() { + public @Nullable File getMergeInfoHolder() { return null; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuantitySelection.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuantitySelection.java index 44502310a8b7..0a457911a0fb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuantitySelection.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuantitySelection.java @@ -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 org.jetbrains.idea.svn.integrate; import org.jetbrains.annotations.NotNull; @@ -7,8 +7,8 @@ import java.util.HashSet; import java.util.Set; public class QuantitySelection { - @NotNull private final Group mySelected; - @NotNull private final Group myUnselected; + private final @NotNull Group mySelected; + private final @NotNull Group myUnselected; public QuantitySelection(boolean startFromSelectAll) { mySelected = new Group<>(); @@ -46,13 +46,11 @@ public class QuantitySelection { mySelected.setAll(); } - @NotNull - public Set getSelected() { + public @NotNull Set getSelected() { return mySelected.getItems(); } - @NotNull - public Set getUnselected() { + public @NotNull Set getUnselected() { return myUnselected.getItems(); } @@ -66,7 +64,7 @@ public class QuantitySelection { private static class Group { private boolean myAll; - @NotNull private final Set myItems = new HashSet<>(); + private final @NotNull Set myItems = new HashSet<>(); public void add(T t) { myItems.add(t); @@ -87,8 +85,7 @@ public class QuantitySelection { myItems.clear(); } - @NotNull - public Set getItems() { + public @NotNull Set getItems() { return myItems; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMerge.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMerge.java index 96ed1e7298e0..674d17a05bd0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMerge.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMerge.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.diagnostic.Logger; @@ -32,9 +32,9 @@ public class QuickMerge extends BackgroundTaskGroup { private static final Logger LOG = Logger.getInstance(QuickMerge.class); - @NotNull private final MergeContext myMergeContext; - @NotNull private final QuickMergeInteraction myInteraction; - @NotNull private final Semaphore mySemaphore = new Semaphore(); + private final @NotNull MergeContext myMergeContext; + private final @NotNull QuickMergeInteraction myInteraction; + private final @NotNull Semaphore mySemaphore = new Semaphore(); public QuickMerge(@NotNull MergeContext mergeContext, @NotNull QuickMergeInteraction interaction) { super(mergeContext.getProject(), mergeContext.getMergeTitle()); @@ -42,13 +42,11 @@ public class QuickMerge extends BackgroundTaskGroup { myInteraction = interaction; } - @NotNull - public MergeContext getMergeContext() { + public @NotNull MergeContext getMergeContext() { return myMergeContext; } - @NotNull - public QuickMergeInteraction getInteraction() { + public @NotNull QuickMergeInteraction getInteraction() { return myInteraction; } @@ -188,8 +186,7 @@ public class QuickMerge extends BackgroundTaskGroup { newIntegrateTask(title, mergerFactory).queue())))); } - @NotNull - private Task newIntegrateTask(@ProgressTitle @NotNull String title, @NotNull MergerFactory mergerFactory) { + private @NotNull Task newIntegrateTask(@ProgressTitle @NotNull String title, @NotNull MergerFactory mergerFactory) { return new SvnIntegrateChangesTask(myMergeContext.getVcs(), new WorkingCopyInfo(myMergeContext.getWcInfo().getPath(), true), mergerFactory, myMergeContext.getSourceUrl(), title, false, myMergeContext.getBranchName()) { @@ -214,8 +211,7 @@ public class QuickMerge extends BackgroundTaskGroup { checkRepositoryVersion15(myMergeContext.getVcs(), myMergeContext.getSourceUrl()); } - @NotNull - private MergerFactory createMergeAllFactory(boolean reintegrate, @Nullable WrapperInvertor copyPoint, boolean supportsMergeInfo) { + private @NotNull MergerFactory createMergeAllFactory(boolean reintegrate, @Nullable WrapperInvertor copyPoint, boolean supportsMergeInfo) { long revision = copyPoint != null ? reintegrate ? copyPoint.getWrapped().getTargetRevision() : copyPoint.getWrapped().getSourceRevision() : -1; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeInteractionImpl.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeInteractionImpl.java index 28f3e81c7e8c..e0308bd66917 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeInteractionImpl.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeInteractionImpl.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.project.Project; @@ -31,17 +31,16 @@ import static org.jetbrains.idea.svn.integrate.ToBeMergedDialog.MERGE_ALL_CODE; public class QuickMergeInteractionImpl implements QuickMergeInteraction { - @NotNull private final MergeContext myMergeContext; - @NotNull private final Project myProject; + private final @NotNull MergeContext myMergeContext; + private final @NotNull Project myProject; public QuickMergeInteractionImpl(@NotNull MergeContext mergeContext) { myMergeContext = mergeContext; myProject = mergeContext.getProject(); } - @NotNull @Override - public QuickMergeContentsVariants selectMergeVariant() { + public @NotNull QuickMergeContentsVariants selectMergeVariant() { QuickMergeWayOptionsPanel panel = new QuickMergeWayOptionsPanel(); DialogBuilder builder = new DialogBuilder(myProject); @@ -63,12 +62,11 @@ public class QuickMergeInteractionImpl implements QuickMergeInteraction { message("dialog.message.merge.confirm.reintegrate", myMergeContext.getSourceUrl().toDecodedString(), targetUrl.toDecodedString()))); } - @NotNull @Override - public SelectMergeItemsResult selectMergeItems(@NotNull List lists, - @NotNull MergeChecker mergeChecker, - boolean allStatusesCalculated, - boolean allListsLoaded) { + public @NotNull SelectMergeItemsResult selectMergeItems(@NotNull List lists, + @NotNull MergeChecker mergeChecker, + boolean allStatusesCalculated, + boolean allListsLoaded) { ToBeMergedDialog dialog = new ToBeMergedDialog(myMergeContext, lists, mergeChecker, allStatusesCalculated, allListsLoaded); dialog.show(); @@ -78,9 +76,8 @@ public class QuickMergeInteractionImpl implements QuickMergeInteraction { return new SelectMergeItemsResult(resultCode, selectedLists); } - @NotNull @Override - public LocalChangesAction selectLocalChangesAction(boolean mergeAll) { + public @NotNull LocalChangesAction selectLocalChangesAction(boolean mergeAll) { LocalChangesAction[] possibleResults; String message; @@ -121,8 +118,7 @@ public class QuickMergeInteractionImpl implements QuickMergeInteraction { return showOkCancelDialog(myProject, question, myMergeContext.getMergeTitle(), getQuestionIcon()) == OK; } - @NotNull - private static QuickMergeContentsVariants toMergeVariant(int exitCode) { + private static @NotNull QuickMergeContentsVariants toMergeVariant(int exitCode) { return switch (exitCode) { case MERGE_ALL_CODE -> QuickMergeContentsVariants.all; case OK_EXIT_CODE -> QuickMergeContentsVariants.select; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeWayOptionsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeWayOptionsPanel.java index 5a1a54a8f705..cb8e7861324f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeWayOptionsPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMergeWayOptionsPanel.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.ui.DialogWrapper; @@ -66,8 +52,7 @@ public class QuickMergeWayOptionsPanel { myWrapper = wrapper; } - @NotNull - public QuickMergeContentsVariants getVariant() { + public @NotNull QuickMergeContentsVariants getVariant() { return myVariant; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectMergeItemsResult.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectMergeItemsResult.java index e27ab9f35d4c..2fe110d94ec4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectMergeItemsResult.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectMergeItemsResult.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.idea.svn.integrate; import org.jetbrains.annotations.NotNull; @@ -21,21 +7,19 @@ import org.jetbrains.idea.svn.history.SvnChangeList; import java.util.List; public class SelectMergeItemsResult { - @NotNull private final QuickMergeContentsVariants myResultCode; - @NotNull private final List myLists; + private final @NotNull QuickMergeContentsVariants myResultCode; + private final @NotNull List myLists; public SelectMergeItemsResult(@NotNull QuickMergeContentsVariants resultCode, @NotNull List lists) { myResultCode = resultCode; myLists = lists; } - @NotNull - public QuickMergeContentsVariants getResultCode() { + public @NotNull QuickMergeContentsVariants getResultCode() { return myResultCode; } - @NotNull - public List getSelectedLists() { + public @NotNull List getSelectedLists() { return myLists; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectedChangeSetChecker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectedChangeSetChecker.java index 9a14b9bc1366..353e047b6242 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectedChangeSetChecker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SelectedChangeSetChecker.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -12,7 +12,7 @@ import java.util.HashSet; import java.util.Set; public class SelectedChangeSetChecker extends SelectedChangeListsChecker { - @NotNull private final Set mySelectedChanges = new HashSet<>(); + private final @NotNull Set mySelectedChanges = new HashSet<>(); private void fillChanges(final AnActionEvent event) { mySelectedChanges.clear(); @@ -34,8 +34,7 @@ public class SelectedChangeSetChecker extends SelectedChangeListsChecker { return super.isValid() && (myChangeListsList.size() == 1) && (!mySelectedChanges.isEmpty()); } - @NotNull - public Collection getSelectedChanges() { + public @NotNull Collection getSelectedChanges() { return mySelectedChanges; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnBranchPointsCalculator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnBranchPointsCalculator.java index 35707001e605..861e94ccfba9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnBranchPointsCalculator.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnBranchPointsCalculator.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.application.PathManager; @@ -28,9 +28,9 @@ public class SvnBranchPointsCalculator { private static final Logger LOG = Logger.getInstance(SvnBranchPointsCalculator.class); - @NotNull private final SmallMapSerializer> myPersistentMap; - @NotNull private final Object myPersistenceLock = new Object(); - @NotNull private final SvnVcs myVcs; + private final @NotNull SmallMapSerializer> myPersistentMap; + private final @NotNull Object myPersistenceLock = new Object(); + private final @NotNull SvnVcs myVcs; public SvnBranchPointsCalculator(@NotNull SvnVcs vcs) { myVcs = vcs; @@ -40,8 +40,7 @@ public class SvnBranchPointsCalculator { myPersistentMap = new SmallMapSerializer<>(file, DECODED_URL_DESCRIPTOR, new BranchDataExternalizer()); } - @Nullable - public WrapperInvertor getBestHit(@NotNull Url repoUrl, @NotNull Url sourceUrl, @NotNull Url targetUrl) { + public @Nullable WrapperInvertor getBestHit(@NotNull Url repoUrl, @NotNull Url sourceUrl, @NotNull Url targetUrl) { synchronized (myPersistenceLock) { WrapperInvertor result = null; TreeMap map = myPersistentMap.get(repoUrl); @@ -85,8 +84,7 @@ public class SvnBranchPointsCalculator { } } - @Nullable - private static BranchCopyData getBranchData(@NotNull NavigableMap map, @NotNull Url url) { + private static @Nullable BranchCopyData getBranchData(@NotNull NavigableMap map, @NotNull Url url) { Map.Entry branchData = map.floorEntry(url.toString()); return branchData != null && url.toString().startsWith(branchData.getKey()) ? branchData.getValue() : null; } @@ -109,8 +107,7 @@ public class SvnBranchPointsCalculator { } @Override - @NotNull - public TreeMap read(@NotNull DataInput in) throws IOException { + public @NotNull TreeMap read(@NotNull DataInput in) throws IOException { TreeMap result = new TreeMap<>(); int size = in.readInt(); @@ -121,8 +118,7 @@ public class SvnBranchPointsCalculator { return result; } - @NotNull - private static BranchCopyData readCopyPoint(@NotNull DataInput in) throws IOException { + private static @NotNull BranchCopyData readCopyPoint(@NotNull DataInput in) throws IOException { Url source = ENCODED_URL_DESCRIPTOR.read(in); Url target = ENCODED_URL_DESCRIPTOR.read(in); long sourceRevision = in.readLong(); @@ -163,8 +159,7 @@ public class SvnBranchPointsCalculator { } } - @Nullable - public WrapperInvertor calculateCopyPoint(@NotNull Url repoUrl, @NotNull Url sourceUrl, @NotNull Url targetUrl) + public @Nullable WrapperInvertor calculateCopyPoint(@NotNull Url repoUrl, @NotNull Url sourceUrl, @NotNull Url targetUrl) throws VcsException { WrapperInvertor result = getBestHit(repoUrl, sourceUrl, targetUrl); @@ -204,8 +199,8 @@ public class SvnBranchPointsCalculator { } public static class BranchCopyData { - @NotNull private final Url mySource; - @NotNull private final Url myTarget; + private final @NotNull Url mySource; + private final @NotNull Url myTarget; private final long mySourceRevision; private final long myTargetRevision; @@ -221,8 +216,7 @@ public class SvnBranchPointsCalculator { return "source: " + mySource + "@" + mySourceRevision + " target: " + myTarget + "@" + myTargetRevision; } - @NotNull - public Url getSource() { + public @NotNull Url getSource() { return mySource; } @@ -230,8 +224,7 @@ public class SvnBranchPointsCalculator { return mySourceRevision; } - @NotNull - public Url getTarget() { + public @NotNull Url getTarget() { return myTarget; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesActionPerformer.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesActionPerformer.java index 96a41a3b0f10..51d2ddb782f4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesActionPerformer.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesActionPerformer.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.openapi.project.Project; @@ -19,7 +19,7 @@ import static org.jetbrains.idea.svn.SvnUtil.isAncestor; public class SvnIntegrateChangesActionPerformer implements SelectBranchPopup.BranchSelectedCallback { private final SvnVcs myVcs; - @NotNull private final MergerFactory myMergerFactory; + private final @NotNull MergerFactory myMergerFactory; private final Url myCurrentBranch; @@ -47,10 +47,9 @@ public class SvnIntegrateChangesActionPerformer implements SelectBranchPopup.Bra } } - @Nullable - private Pair selectWorkingCopy(@NotNull Url url, - @Nullable String selectedLocalBranchPath, - @DialogTitle @Nullable String dialogTitle) { + private @Nullable Pair selectWorkingCopy(@NotNull Url url, + @Nullable String selectedLocalBranchPath, + @DialogTitle @Nullable String dialogTitle) { return IntegratedSelectedOptionsDialog .selectWorkingCopy(myVcs.getProject(), myCurrentBranch, url, true, selectedLocalBranchPath, dialogTitle); } @@ -67,8 +66,7 @@ public class SvnIntegrateChangesActionPerformer implements SelectBranchPopup.Bra } } - @Nullable - private Url correctSourceUrl(@NotNull Url targetUrl, @NotNull Url realTargetUrl) { + private @Nullable Url correctSourceUrl(@NotNull Url targetUrl, @NotNull Url realTargetUrl) { if (isAncestor(targetUrl, realTargetUrl)) { try { return myCurrentBranch.appendPath(getRelativeUrl(targetUrl, realTargetUrl), false); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java index cafbfc4e9cf8..2b12c062cf15 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/SvnIntegrateChangesTask.java @@ -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 org.jetbrains.idea.svn.integrate; import com.intellij.configurationStore.StoreReloadManager; @@ -91,7 +91,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { } @Override - public void run(@NotNull final ProgressIndicator indicator) { + public void run(final @NotNull ProgressIndicator indicator) { myHandler.setProgressIndicator(ProgressManager.getInstance().getProgressIndicator()); myResolveWorker = new ResolveWorker(myInfo.isUnderProjectRoot(), myProject); @@ -124,8 +124,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { } } - @NotNull - private static VcsException createException(boolean isWarning, @Nls @Nullable String @NotNull ... messages) { + private static @NotNull VcsException createException(boolean isWarning, @Nls @Nullable String @NotNull ... messages) { Collection notEmptyMessages = ContainerUtil.mapNotNull(messages, message -> StringUtil.nullize(message, true)); return new VcsException(notEmptyMessages).setIsWarning(isWarning); @@ -271,8 +270,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { }); } - @NotNull - private Collection gatherChangedPaths() { + private @NotNull Collection gatherChangedPaths() { final Collection result = new ArrayList<>(); UpdateFilesHelper.iterateFileGroupFiles(myAccumulatedFiles.getUpdatedFiles(), @@ -295,7 +293,7 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { showAlienCommit(dirtyScope); } - private void showAlienCommit(@NotNull final AlienDirtyScope dirtyScope) { + private void showAlienCommit(final @NotNull AlienDirtyScope dirtyScope) { new Task.Backgroundable(myVcs.getProject(), message("action.Subversion.integrate.changes.collecting.changes.to.commit.task.title")) { @@ -339,27 +337,23 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { } private static class FakeGate implements ChangeListManagerGate { - @NotNull @Override - public List getListsCopy() { + public @NotNull List getListsCopy() { throw new UnsupportedOperationException(); } - @Nullable @Override - public LocalChangeList findChangeList(String name) { + public @Nullable LocalChangeList findChangeList(String name) { throw new UnsupportedOperationException(); } - @NotNull @Override - public LocalChangeList addChangeList(@NotNull String name, String comment) { + public @NotNull LocalChangeList addChangeList(@NotNull String name, String comment) { throw new UnsupportedOperationException(); } - @NotNull @Override - public LocalChangeList findOrCreateList(@NotNull String name, String comment) { + public @NotNull LocalChangeList findOrCreateList(@NotNull String name, String comment) { throw new UnsupportedOperationException(); } @@ -383,9 +377,8 @@ public class SvnIntegrateChangesTask extends Task.Backgroundable { throw new UnsupportedOperationException(); } - @Nullable @Override - public FileStatus getStatus(@NotNull FilePath filePath) { + public @Nullable FileStatus getStatus(@NotNull FilePath filePath) { throw new UnsupportedOperationException(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java index f6fb96506562..b898eae4d150 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/ToBeMergedDialog.java @@ -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 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 org.jetbrains.idea.svn.integrate; import com.intellij.icons.AllIcons; @@ -47,8 +47,8 @@ import java.awt.event.ActionEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; -import java.util.List; import java.util.*; +import java.util.List; import java.util.stream.Collectors; import static com.intellij.openapi.vcs.changes.committed.CommittedChangesTreeBrowser.collectChanges; @@ -64,8 +64,8 @@ import static org.jetbrains.idea.svn.integrate.MergeCalculatorTask.loadChangeLis public class ToBeMergedDialog extends DialogWrapper { public static final int MERGE_ALL_CODE = 222; private final JPanel myPanel; - @NotNull private final MergeContext myMergeContext; - @NotNull private final ListTableModel myRevisionsModel; + private final @NotNull MergeContext myMergeContext; + private final @NotNull ListTableModel myRevisionsModel; private TableView myRevisionsList; private CommittedChangesBrowser myRepositoryChangesBrowser; private Splitter mySplitter; @@ -145,7 +145,7 @@ public class ToBeMergedDialog extends DialogWrapper { myDisposed = true; } - private void refreshListStatus(@NotNull final List changeLists) { + private void refreshListStatus(final @NotNull List changeLists) { if (myDisposed) return; ApplicationManager.getApplication().executeOnPooledThread(() -> { int cnt = 10; @@ -167,8 +167,7 @@ public class ToBeMergedDialog extends DialogWrapper { }); } - @NotNull - private static ListMergeStatus toListMergeStatus(@NotNull MergeCheckResult mergeCheckResult) { + private static @NotNull ListMergeStatus toListMergeStatus(@NotNull MergeCheckResult mergeCheckResult) { return switch (mergeCheckResult) { case MERGED -> ListMergeStatus.MERGED; case NOT_EXISTS -> ListMergeStatus.ALIEN; @@ -191,8 +190,7 @@ public class ToBeMergedDialog extends DialogWrapper { } } - @NotNull - public List getSelected() { + public @NotNull List getSelected() { Set selected = myWiseSelection.getSelected(); Set unselected = myWiseSelection.getUnselected(); // todo: can be made faster @@ -280,15 +278,13 @@ public class ToBeMergedDialog extends DialogWrapper { myPanel.add(mySplitter, BorderLayout.CENTER); } - @NotNull - private ActionToolbar createToolbar() { + private @NotNull ActionToolbar createToolbar() { DefaultActionGroup actions = new DefaultActionGroup(new MySelectAll(), new MyUnselectAll(), myMore100Action, myMore500Action); return ActionManager.getInstance().createActionToolbar("SvnToBeMerged", actions, true); } - @NotNull - private List getAlreadyMergedPaths(@NotNull SvnChangeList svnChangeList) { + private @NotNull List getAlreadyMergedPaths(@NotNull SvnChangeList svnChangeList) { Collection notMerged = myMergeChecker.getNotMergedPaths(svnChangeList); return isEmpty(notMerged) ? ContainerUtil.emptyList() : svnChangeList.getAffectedPaths().stream() diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java index af1370600e31..741d8b4a5e1f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.lock; import com.intellij.openapi.vcs.VcsException; @@ -69,8 +55,7 @@ public class CmdLockClient extends BaseSvnClient implements LockClient { callHandler(handler, createEvent(file, error == null ? success : failure, error)); } - @NotNull - private static ProgressEvent createEvent(@NotNull File file, @NotNull EventAction action, @Nullable String error) { + private static @NotNull ProgressEvent createEvent(@NotNull File file, @NotNull EventAction action, @Nullable String error) { return new ProgressEvent(file, -1, null, null, action, error, null); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java index 06fbbbd85002..f96512f829d1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/Lock.java @@ -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 org.jetbrains.idea.svn.lock; import com.intellij.openapi.vcs.changes.LogicalLock; @@ -30,7 +16,7 @@ public class Lock { private final String myOwner; private final String myComment; private final Date myCreationDate; - @Nullable private final Date myExpirationDate; + private final @Nullable Date myExpirationDate; public Lock(@NotNull Lock.Builder builder) { myOwner = builder.owner; @@ -47,8 +33,7 @@ public class Lock { return myCreationDate; } - @Nullable - public Date getExpirationDate() { + public @Nullable Date getExpirationDate() { return myExpirationDate; } @@ -56,8 +41,7 @@ public class Lock { return myOwner; } - @NotNull - public LogicalLock toLogicalLock(boolean isLocal) { + public @NotNull LogicalLock toLogicalLock(boolean isLocal) { return new LogicalLock(isLocal, myOwner, myComment, myCreationDate, myExpirationDate); } @@ -78,41 +62,34 @@ public class Lock { @XmlElement(name = "created") private Date created; - @XmlElement(name = "expires") - @Nullable private Date expires; + @XmlElement(name = "expires") private @Nullable Date expires; - @NotNull - public Builder setToken(String token) { + public @NotNull Builder setToken(String token) { this.token = token; return this; } - @NotNull - public Builder setOwner(String owner) { + public @NotNull Builder setOwner(String owner) { this.owner = owner; return this; } - @NotNull - public Builder setComment(String comment) { + public @NotNull Builder setComment(String comment) { this.comment = comment; return this; } - @NotNull - public Builder setCreationDate(Date creationDate) { + public @NotNull Builder setCreationDate(Date creationDate) { this.created = creationDate; return this; } - @NotNull - public Builder setExpirationDate(@Nullable Date expirationDate) { + public @NotNull Builder setExpirationDate(@Nullable Date expirationDate) { this.expires = expirationDate; return this; } - @NotNull - public Lock build() { + public @NotNull Lock build() { return new Lock(this); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java index ebd99b74b4a7..80bafd4233cc 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/BranchInfo.java @@ -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 org.jetbrains.idea.svn.mergeinfo; import com.intellij.openapi.diagnostic.Logger; @@ -25,23 +25,23 @@ import static org.jetbrains.idea.svn.SvnUtil.*; public class BranchInfo { - private final static Logger LOG = Logger.getInstance(BranchInfo.class); + private static final Logger LOG = Logger.getInstance(BranchInfo.class); // repo path in branch in format path@revision -> merged revisions - @NotNull private final Map> myPathMergedMap; - @NotNull private final Map> myNonInheritablePathMergedMap; + private final @NotNull Map> myPathMergedMap; + private final @NotNull Map> myNonInheritablePathMergedMap; private boolean myMixedRevisionsFound; // revision in trunk -> whether merged into branch - @NotNull private final Map myAlreadyCalculatedMap; - @NotNull private final Object myCalculatedLock = new Object(); + private final @NotNull Map myAlreadyCalculatedMap; + private final @NotNull Object myCalculatedLock = new Object(); - @NotNull private final WCInfoWithBranches myInfo; - @NotNull private final WCInfoWithBranches.Branch myBranch; - @NotNull private final SvnVcs myVcs; + private final @NotNull WCInfoWithBranches myInfo; + private final @NotNull WCInfoWithBranches.Branch myBranch; + private final @NotNull SvnVcs myVcs; private SvnMergeInfoCache.CopyRevison myCopyRevison; - @NotNull private final MultiMap myPartlyMerged; + private final @NotNull MultiMap myPartlyMerged; public BranchInfo(@NotNull SvnVcs vcs, @NotNull WCInfoWithBranches info, @NotNull WCInfoWithBranches.Branch branch) { myVcs = vcs; @@ -72,8 +72,7 @@ public class BranchInfo { myMixedRevisionsFound = false; } - @NotNull - public MergeInfoCached getCached() { + public @NotNull MergeInfoCached getCached() { synchronized (myCalculatedLock) { long revision = myCopyRevison != null ? myCopyRevison.getRevision() : -1; @@ -83,8 +82,7 @@ public class BranchInfo { } // branch path - is local working copy path - @NotNull - public MergeCheckResult checkList(@NotNull final SvnChangeList list, final String branchPath) { + public @NotNull MergeCheckResult checkList(final @NotNull SvnChangeList list, final String branchPath) { synchronized (myCalculatedLock) { MergeCheckResult result; final long revision = calculateCopyRevision(branchPath); @@ -98,8 +96,7 @@ public class BranchInfo { } } - @NotNull - private MergeCheckResult checkAlive(@NotNull SvnChangeList list, @NotNull String branchPath) { + private @NotNull MergeCheckResult checkAlive(@NotNull SvnChangeList list, @NotNull String branchPath) { final Info info = myVcs.getInfo(new File(branchPath)); if (info == null || info.getUrl() == null || !isAncestor(myBranch.getUrl(), info.getUrl())) { return MergeCheckResult.NOT_MERGED; @@ -117,10 +114,9 @@ public class BranchInfo { return MergeCheckResult.MERGED; } - @NotNull - private MultiMap checkPaths(@NotNull SvnChangeList list, - @NotNull String branchPath, - @NotNull Url underBranchUrl) { + private @NotNull MultiMap checkPaths(@NotNull SvnChangeList list, + @NotNull String branchPath, + @NotNull Url underBranchUrl) { MultiMap result = MultiMap.create(); String subPathUnderBranch = getRelativeUrl(myBranch.getUrl(), underBranchUrl); Url myTrunkUrlCorrespondingToLocalBranchPath = appendPath(myInfo.getCurrentBranch().getUrl(), subPathUnderBranch); @@ -157,12 +153,11 @@ public class BranchInfo { return result; } - @NotNull - private MergeCheckResult goUp(final long revisionAsked, - final long targetRevision, - final String branchRootPath, - final String path, - @NotNull String trunkUrl) throws VcsException { + private @NotNull MergeCheckResult goUp(final long revisionAsked, + final long targetRevision, + final String branchRootPath, + final String path, + @NotNull String trunkUrl) throws VcsException { MergeCheckResult result; String newTrunkUrl = Url.removeTail(trunkUrl).trim(); @@ -192,11 +187,10 @@ public class BranchInfo { return result; } - @NotNull - private MergeCheckResult goUpInRepo(final long revisionAsked, - final long targetRevision, - final Url branchUrl, - final String trunkUrl) throws VcsException { + private @NotNull MergeCheckResult goUpInRepo(final long revisionAsked, + final long targetRevision, + final Url branchUrl, + final String trunkUrl) throws VcsException { MergeCheckResult result; Set mergeInfo = myPathMergedMap.get(branchUrl.toString() + "@" + targetRevision); @@ -228,13 +222,12 @@ public class BranchInfo { return result; } - @NotNull - private MergeCheckResult checkPathGoingUp(final long revisionAsked, - final long targetRevision, - @NotNull String branchRootPath, - @NotNull String path, - final String trunkUrl, - final boolean self) throws VcsException { + private @NotNull MergeCheckResult checkPathGoingUp(final long revisionAsked, + final long targetRevision, + @NotNull String branchRootPath, + @NotNull String path, + final String trunkUrl, + final boolean self) throws VcsException { MergeCheckResult result; final File pathFile = new File(path); @@ -295,12 +288,11 @@ public class BranchInfo { return result; } - @NotNull - private MergeCheckResult processMergeinfoProperty(final String pathWithRevisionNumber, - final long revisionAsked, - @NotNull PropertyValue value, - final String trunkRelativeUrl, - final boolean self) throws SvnBindException { + private @NotNull MergeCheckResult processMergeinfoProperty(final String pathWithRevisionNumber, + final long revisionAsked, + @NotNull PropertyValue value, + final String trunkRelativeUrl, + final boolean self) throws SvnBindException { MergeCheckResult result; Map mergedPathsMap = MergeRangeList.parseMergeInfo(value.toString()); String mergedPathAffectingTrunkUrl = ContainerUtil.find(mergedPathsMap.keySet(), path -> trunkRelativeUrl.startsWith(path)); @@ -345,13 +337,11 @@ public class BranchInfo { // if nothing, maybe all not merged or merged: here only partly not merged @SuppressWarnings("unused") - @NotNull - public Collection getNotMergedPaths(final long number) { + public @NotNull Collection getNotMergedPaths(final long number) { return myPartlyMerged.get(number); } - @NotNull - private static Url appendPath(@NotNull Url url, @NotNull String path) { + private static @NotNull Url appendPath(@NotNull Url url, @NotNull String path) { try { return url.appendPath(path, false); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java index 0097d7c365ff..b4af2f8abe2a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java @@ -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 org.jetbrains.idea.svn.mergeinfo; import com.intellij.openapi.application.ApplicationManager; @@ -22,13 +22,13 @@ import java.util.Map; public class MergeInfoHolder { - @NotNull private final DecoratorManager myManager; - @NotNull private final SvnMergeInfoCache myMergeInfoCache; - @NotNull private final RootsAndBranches myMainPanel; - @NotNull private final SvnMergeInfoRootPanelManual myPanel; + private final @NotNull DecoratorManager myManager; + private final @NotNull SvnMergeInfoCache myMergeInfoCache; + private final @NotNull RootsAndBranches myMainPanel; + private final @NotNull SvnMergeInfoRootPanelManual myPanel; // used ONLY when refresh is triggered - @NotNull private final Map, MergeInfoCached> myCachedMap; + private final @NotNull Map, MergeInfoCached> myCachedMap; public MergeInfoHolder(@NotNull Project project, @NotNull DecoratorManager manager, @@ -41,13 +41,11 @@ public class MergeInfoHolder { myCachedMap = new HashMap<>(); } - @NotNull - private Pair getCacheKey() { + private @NotNull Pair getCacheKey() { return Pair.create(myPanel.getWcInfo(), myPanel.getBranch().getUrl()); } - @Nullable - private MergeInfoCached getCurrentCache() { + private @Nullable MergeInfoCached getCurrentCache() { return myCachedMap.get(getCacheKey()); } @@ -61,8 +59,7 @@ public class MergeInfoHolder { return isEnabledAndConfigured(ignoreEnabled) && getCurrentCache() == null; } - @NotNull - public ListMergeStatus refresh(final boolean ignoreEnabled) { + public @NotNull ListMergeStatus refresh(final boolean ignoreEnabled) { final CommittedChangeListsListener refresher = createRefresher(ignoreEnabled); if (refresher != null) { myManager.reportLoadedLists(refresher); @@ -72,8 +69,7 @@ public class MergeInfoHolder { return ListMergeStatus.REFRESHING; } - @Nullable - public CommittedChangeListsListener createRefresher(boolean ignoreEnabled) { + public @Nullable CommittedChangeListsListener createRefresher(boolean ignoreEnabled) { CommittedChangeListsListener result = null; if (refreshEnabled(ignoreEnabled)) { @@ -90,7 +86,7 @@ public class MergeInfoHolder { private final class MyRefresher implements CommittedChangeListsListener { - @NotNull private final WCInfoWithBranches myRefreshedRoot; + private final @NotNull WCInfoWithBranches myRefreshedRoot; private final WCInfoWithBranches.Branch myRefreshedBranch; private final String myBranchPath; @@ -131,14 +127,12 @@ public class MergeInfoHolder { }); } - @NotNull - private Pair getCacheKey() { + private @NotNull Pair getCacheKey() { return Pair.create(myRefreshedRoot, myRefreshedBranch.getUrl()); } } - @NotNull - public ListMergeStatus check(final CommittedChangeList list, final boolean ignoreEnabled) { + public @NotNull ListMergeStatus check(final CommittedChangeList list, final boolean ignoreEnabled) { ListMergeStatus result; if (!isEnabledAndConfigured(ignoreEnabled) || !(list instanceof SvnChangeList)) { @@ -154,8 +148,7 @@ public class MergeInfoHolder { return result; } - @NotNull - public ListMergeStatus check(@NotNull CommittedChangeList list, @NotNull MergeInfoCached state, boolean isCached) { + public @NotNull ListMergeStatus check(@NotNull CommittedChangeList list, @NotNull MergeInfoCached state, boolean isCached) { MergeCheckResult mergeCheckResult = state.getMap().get(list.getNumber()); ListMergeStatus result = state.copiedAfter(list) ? ListMergeStatus.COMMON : ListMergeStatus.from(mergeCheckResult); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneShotMergeInfoHelper.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneShotMergeInfoHelper.java index bfe5f3f98336..485437369466 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneShotMergeInfoHelper.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/OneShotMergeInfoHelper.java @@ -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 org.jetbrains.idea.svn.mergeinfo; import com.intellij.openapi.progress.ProgressManager; @@ -33,11 +33,11 @@ import static org.jetbrains.idea.svn.SvnUtil.ensureStartSlash; public class OneShotMergeInfoHelper implements MergeChecker { - @NotNull private final MergeContext myMergeContext; - @NotNull private final Map> myPartiallyMerged; + private final @NotNull MergeContext myMergeContext; + private final @NotNull Map> myPartiallyMerged; // subpath [file] (local) to (subpathURL - merged FROM - to ranges list) - @NotNull private final NavigableMap> myMergeInfoMap; - @NotNull private final Object myMergeInfoLock; + private final @NotNull NavigableMap> myMergeInfoMap; + private final @NotNull Object myMergeInfoLock; public OneShotMergeInfoHelper(@NotNull MergeContext mergeContext) { myMergeContext = mergeContext; @@ -56,14 +56,12 @@ public class OneShotMergeInfoHelper implements MergeChecker { } @Override - @Nullable - public Collection getNotMergedPaths(@NotNull SvnChangeList changeList) { + public @Nullable Collection getNotMergedPaths(@NotNull SvnChangeList changeList) { return myPartiallyMerged.get(changeList.getNumber()); } @Override - @NotNull - public MergeCheckResult checkList(@NotNull SvnChangeList changeList) { + public @NotNull MergeCheckResult checkList(@NotNull SvnChangeList changeList) { Set notMergedPaths = new HashSet<>(); boolean hasMergedPaths = false; @@ -84,8 +82,7 @@ public class OneShotMergeInfoHelper implements MergeChecker { : MergeCheckResult.NOT_MERGED; } - @NotNull - public MergeCheckResult checkPath(@NotNull String repositoryRelativePath, long revisionNumber) { + public @NotNull MergeCheckResult checkPath(@NotNull String repositoryRelativePath, long revisionNumber) { MergeCheckResult result = MergeCheckResult.NOT_EXISTS; String sourceRelativePath = Url.getRelative(myMergeContext.getRepositoryRelativeSourcePath(), ensureStartSlash(repositoryRelativePath)); @@ -120,9 +117,9 @@ public class OneShotMergeInfoHelper implements MergeChecker { private static class InfoProcessor implements PairProcessor> { - @NotNull private final String myRepositoryRelativeSourcePath; + private final @NotNull String myRepositoryRelativeSourcePath; private boolean myIsMerged; - @NotNull private final String mySourceRelativePath; + private final @NotNull String mySourceRelativePath; private final long myRevisionNumber; InfoProcessor(@NotNull String sourceRelativePath, @NotNull String repositoryRelativeSourcePath, long revisionNumber) { @@ -162,8 +159,7 @@ public class OneShotMergeInfoHelper implements MergeChecker { } } - @NotNull - private PropertyConsumer createPropertyHandler() { + private @NotNull PropertyConsumer createPropertyHandler() { return new PropertyConsumer() { @Override public void handleProperty(@NotNull File path, @NotNull PropertyData property) throws SvnBindException { @@ -177,13 +173,11 @@ public class OneShotMergeInfoHelper implements MergeChecker { }; } - @NotNull - private String getWorkingCopyRelativePath(@NotNull File file) { + private @NotNull String getWorkingCopyRelativePath(@NotNull File file) { return toSystemIndependentName(Objects.requireNonNull(getRelativePath(myMergeContext.getWcInfo().getRootInfo().getIoFile(), file))); } - @NotNull - private static String toKey(@NotNull String path) { + private static @NotNull String toKey(@NotNull String path) { return SystemInfo.isFileSystemCaseSensitive ? path : toUpperCase(path); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/SvnMergeInfoCache.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/SvnMergeInfoCache.java index c17a5542579a..528d1b72e5e4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/SvnMergeInfoCache.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/SvnMergeInfoCache.java @@ -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 org.jetbrains.idea.svn.mergeinfo; import com.intellij.openapi.components.Service; @@ -31,11 +31,11 @@ import static org.jetbrains.idea.svn.SvnBundle.message; @Service(Service.Level.PROJECT) public final class SvnMergeInfoCache { - private final static Logger LOG = Logger.getInstance(SvnMergeInfoCache.class); + private static final Logger LOG = Logger.getInstance(SvnMergeInfoCache.class); - @NotNull private final Project myProject; + private final @NotNull Project myProject; // key - working copy root url - @NotNull private final Map myCurrentUrlMapping; + private final @NotNull Map myCurrentUrlMapping; @Topic.ProjectLevel public static final Topic SVN_MERGE_INFO_CACHE = @@ -58,8 +58,7 @@ public final class SvnMergeInfoCache { } } - @Nullable - public MergeInfoCached getCachedState(@NotNull WCInfoWithBranches info, String branchPath) { + public @Nullable MergeInfoCached getCachedState(@NotNull WCInfoWithBranches info, String branchPath) { BranchInfo branchInfo = getBranchInfo(info, branchPath); return branchInfo != null ? branchInfo.getCached() : null; @@ -92,8 +91,7 @@ public final class SvnMergeInfoCache { return branchInfo != null && branchInfo.isMixedRevisionsFound(); } - @Nullable - private BranchInfo getBranchInfo(@NotNull WCInfoWithBranches info, String branchPath) { + private @Nullable BranchInfo getBranchInfo(@NotNull WCInfoWithBranches info, String branchPath) { MyCurrentUrlData rootMapping = myCurrentUrlMapping.get(info.getUrl()); return rootMapping != null ? rootMapping.getBranchInfo(branchPath) : null; @@ -155,7 +153,7 @@ public final class SvnMergeInfoCache { private static final class MyCurrentUrlData { // key - working copy local path - @NotNull private final Map myBranchInfo = CollectionFactory.createSoftMap(); + private final @NotNull Map myBranchInfo = CollectionFactory.createSoftMap(); private MyCurrentUrlData() { } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java index 39881b10946c..e76a8c71e580 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/CmdPropertyClient.java @@ -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 org.jetbrains.idea.svn.properties; import com.intellij.openapi.diagnostic.Attachment; @@ -26,12 +26,11 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient { private static final Logger LOG = Logger.getInstance(CmdPropertyClient.class); - @Nullable @Override - public PropertyValue getProperty(@NotNull Target target, - @NotNull String property, - boolean revisionProperty, - @Nullable Revision revision) + public @Nullable PropertyValue getProperty(@NotNull Target target, + @NotNull String property, + boolean revisionProperty, + @Nullable Revision revision) throws SvnBindException { List parameters = new ArrayList<>(); @@ -127,8 +126,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient { return e.contains(ErrorCode.BASE) && e.contains(ErrorCode.PROPERTY_NOT_FOUND); } - @NotNull - private PropertiesMap collectPropertiesToDelete(@NotNull File file) throws SvnBindException { + private @NotNull PropertiesMap collectPropertiesToDelete(@NotNull File file) throws SvnBindException { final PropertiesMap result = new PropertiesMap(); list(Target.on(file), null, Depth.EMPTY, new PropertyConsumer() { @@ -188,8 +186,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient { CommandUtil.put(parameters, verbose, "--verbose"); } - @Nullable - private static PropertyData parseSingleProperty(Target target, @NotNull CommandExecutor command) throws SvnBindException { + private static @Nullable PropertyData parseSingleProperty(Target target, @NotNull CommandExecutor command) throws SvnBindException { final PropertyData[] data = new PropertyData[1]; PropertyConsumer handler = new PropertyConsumer() { @Override @@ -257,8 +254,7 @@ public class CmdPropertyClient extends BaseSvnClient implements PropertyClient { } } - @Nullable - private static PropertyData create(@NotNull String property, @Nullable String value) { + private static @Nullable PropertyData create(@NotNull String property, @Nullable String value) { PropertyData result = null; // such behavior is required to compatibility with SVNKit as some logic in merge depends on diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/ExternalsDefinitionParser.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/ExternalsDefinitionParser.java index e16e229a2efb..073bb9182efb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/ExternalsDefinitionParser.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/properties/ExternalsDefinitionParser.java @@ -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 org.jetbrains.idea.svn.properties; import com.intellij.openapi.util.NlsContexts.DialogMessage; @@ -19,8 +19,7 @@ public final class ExternalsDefinitionParser { * * @return map of externals definitions: key - relative directory, value - corresponding complete externals definition. */ - @NotNull - public static Map parseExternalsProperty(@NotNull String externals) throws SvnBindException { + public static @NotNull Map parseExternalsProperty(@NotNull String externals) throws SvnBindException { HashMap map = new HashMap<>(); for (String external : StringUtil.splitByLines(externals, true)) { @@ -36,8 +35,7 @@ public final class ExternalsDefinitionParser { * - could be quoted with '"' char * - certain chars could be escaped with '\' char */ - @NotNull - public static String parseRelativeDirectory(@NotNull String s) throws SvnBindException { + public static @NotNull String parseRelativeDirectory(@NotNull String s) throws SvnBindException { s = s.trim(); int length = s.length(); @@ -63,8 +61,7 @@ public final class ExternalsDefinitionParser { } } - @NotNull - private static String unescape(@NotNull String s) { + private static @NotNull String unescape(@NotNull String s) { return s.replace("\\", ""); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java index ff980802d80c..f9b97aab5f9c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/revert/CmdRevertClient.java @@ -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 org.jetbrains.idea.svn.revert; import com.intellij.openapi.vcs.VcsException; @@ -58,8 +58,7 @@ public class CmdRevertClient extends BaseSvnClient implements RevertClient { return createEvent(new File(path), createAction(statusMessage)); } - @Nullable - public static EventAction createAction(@NotNull String code) { + public static @Nullable EventAction createAction(@NotNull String code) { return switch (code) { case REVERTED_CODE -> EventAction.REVERT; case FAILED_TO_REVERT_CODE -> EventAction.FAILED_REVERT; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/revision/SvnSelectRevisionPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/revision/SvnSelectRevisionPanel.java index e3aed32c6cc2..58df65c51bb2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/revision/SvnSelectRevisionPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/revision/SvnSelectRevisionPanel.java @@ -1,4 +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 org.jetbrains.idea.svn.revision; import com.intellij.openapi.options.ConfigurationException; @@ -35,8 +35,7 @@ public class SvnSelectRevisionPanel extends JPanel { mySvnRevisionPanel.setRoot(root); } - @NotNull - public Revision getRevision() throws ConfigurationException { + public @NotNull Revision getRevision() throws ConfigurationException { return mySvnRevisionPanel.getRevision(); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesAfterPathComparator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesAfterPathComparator.java index 65d60fb7e045..59ac4a112eac 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesAfterPathComparator.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesAfterPathComparator.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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 org.jetbrains.idea.svn.rollback; import com.intellij.openapi.util.Comparing; @@ -23,8 +9,8 @@ import com.intellij.openapi.vcs.changes.ContentRevision; import java.util.Comparator; public class ChangesAfterPathComparator implements Comparator { - private final static ChangesAfterPathComparator ourInstance = new ChangesAfterPathComparator(); - private final static Comparator ourComparator = + private static final ChangesAfterPathComparator ourInstance = new ChangesAfterPathComparator(); + private static final Comparator ourComparator = (o1, o2) -> FileUtil.compareFiles(o1.getFile().getIOFile(), o2.getFile().getIOFile()); public static ChangesAfterPathComparator getInstance() { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesChecker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesChecker.java index 00d3c9737bb3..b4f5bbcdcbdf 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesChecker.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/ChangesChecker.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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 org.jetbrains.idea.svn.rollback; import com.intellij.openapi.vcs.FilePath; @@ -30,12 +16,12 @@ import java.util.*; public class ChangesChecker { - @NotNull private final SuperfluousRemover myForAdds; - @NotNull private final SuperfluousRemover myForDeletes; + private final @NotNull SuperfluousRemover myForAdds; + private final @NotNull SuperfluousRemover myForDeletes; private final List myForEdits; private final SvnChangeProvider myChangeProvider; - @NotNull private final UnversionedAndNotTouchedFilesGroupCollector myCollector; + private final @NotNull UnversionedAndNotTouchedFilesGroupCollector myCollector; private final List myExceptions; @@ -94,13 +80,11 @@ public class ChangesChecker { } } - @NotNull - public Collection getForAdds() { + public @NotNull Collection getForAdds() { return myForAdds.getParentPaths(); } - @NotNull - public Collection getForDeletes() { + public @NotNull Collection getForDeletes() { return myForDeletes.getParentPaths(); } @@ -108,8 +92,7 @@ public class ChangesChecker { return myExceptions; } - @NotNull - public List getForEdits() { + public @NotNull List getForEdits() { return myForEdits; } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java index e7770e89c4d7..a3f43536e98c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/Reverter.java @@ -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 org.jetbrains.idea.svn.rollback; import com.intellij.openapi.progress.ProcessCanceledException; @@ -23,7 +23,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class Reverter { - @NotNull private final SvnVcs myVcs; + private final @NotNull SvnVcs myVcs; private final ProgressTracker myHandler; private final @NotNull List myExceptions; private final List myFromToModified; @@ -157,9 +157,8 @@ public class Reverter { } } - @NotNull - private static ProgressTracker createRevertHandler(final @NotNull List exceptions, - @NotNull final RollbackProgressListener listener) { + private static @NotNull ProgressTracker createRevertHandler(final @NotNull List exceptions, + final @NotNull RollbackProgressListener listener) { return new ProgressTracker() { @Override public void consume(ProgressEvent event) { @@ -181,9 +180,8 @@ public class Reverter { }; } - @NotNull - private static PropertyConsumer createPropertyHandler(@NotNull final Map properties, - @NotNull final UnversionedAndNotTouchedFilesGroupCollector collector) { + private static @NotNull PropertyConsumer createPropertyHandler(final @NotNull Map properties, + final @NotNull UnversionedAndNotTouchedFilesGroupCollector collector) { return new PropertyConsumer() { @Override public void handleProperty(File path, PropertyData property) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SuperfluousRemover.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SuperfluousRemover.java index a4207ab6ec41..0580de1421cb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SuperfluousRemover.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SuperfluousRemover.java @@ -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 org.jetbrains.idea.svn.rollback; import com.intellij.openapi.vcs.changes.Change; @@ -47,7 +33,7 @@ public class SuperfluousRemover { return false; } - public void check(@NotNull final File file) { + public void check(final @NotNull File file) { boolean parentAlreadyRegistered = ContainerUtil.or(myParentPaths, parentCandidate -> VfsUtilCore.isAncestor(parentCandidate, file, true)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java index 0ce084a79a95..d051fdbf1516 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java @@ -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 org.jetbrains.idea.svn.rollback; import com.intellij.openapi.util.Comparing; @@ -38,9 +38,7 @@ public class SvnRollbackEnvironment extends DefaultRollbackEnvironment { } @Override - @Nls(capitalization = Nls.Capitalization.Title) - @NotNull - public String getRollbackOperationName() { + public @Nls(capitalization = Nls.Capitalization.Title) @NotNull String getRollbackOperationName() { return message("action.name.revert"); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/UnversionedAndNotTouchedFilesGroupCollector.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/UnversionedAndNotTouchedFilesGroupCollector.java index fc99d7944755..651f498abecb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/UnversionedAndNotTouchedFilesGroupCollector.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/UnversionedAndNotTouchedFilesGroupCollector.java @@ -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 org.jetbrains.idea.svn.rollback; import com.intellij.openapi.util.Couple; @@ -32,11 +32,11 @@ public class UnversionedAndNotTouchedFilesGroupCollector extends EmptyChangelist toFromTo(file); } - public void markRename(@NotNull final File beforeFile, @NotNull final File afterFile) { + public void markRename(final @NotNull File beforeFile, final @NotNull File afterFile) { myToBeDeleted.add(Couple.of(beforeFile, afterFile)); } - public ThroughRenameInfo findToFile(@NotNull final FilePath file, @Nullable final File firstTo) { + public ThroughRenameInfo findToFile(final @NotNull FilePath file, final @Nullable File firstTo) { final String path = FilePathsHelper.convertPath(file); if (myAlsoReverted.contains(path)) return null; final NavigableMap head = myRenames.headMap(path, true); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java index 1aa3abefbd0c..72acfd5e4fe3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/status/StatusType.java @@ -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 org.jetbrains.idea.svn.status; import org.jetbrains.annotations.NonNls; @@ -36,7 +36,7 @@ public enum StatusType { private static final @NonNls String STATUS_PREFIX = "STATUS_"; - @NotNull private static final Map ourStatusTypesForStatusOperation = new HashMap<>(); + private static final @NotNull Map ourStatusTypesForStatusOperation = new HashMap<>(); static { for (StatusType action : values()) { @@ -71,8 +71,7 @@ public enum StatusType { } } - @Nullable - public static StatusType forStatusOperation(@NotNull String statusName) { + public static @Nullable StatusType forStatusOperation(@NotNull String statusName) { return ourStatusTypesForStatusOperation.get(statusName); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java index ce162f807ff7..659afec4650f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/ApplyPatchSaveToFileExecutor.java @@ -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 org.jetbrains.idea.svn.treeConflict; import com.intellij.openapi.diagnostic.Logger; @@ -42,8 +42,8 @@ import static com.intellij.util.ObjectUtils.notNull; public final class ApplyPatchSaveToFileExecutor implements ApplyPatchExecutor { private static final Logger LOG = Logger.getInstance(ApplyPatchSaveToFileExecutor.class); - @NotNull private final Project myProject; - @Nullable private final VirtualFile myNewPatchBase; + private final @NotNull Project myProject; + private final @Nullable VirtualFile myNewPatchBase; public ApplyPatchSaveToFileExecutor(@NotNull Project project, @Nullable VirtualFile newPatchBase) { myProject = project; @@ -85,9 +85,8 @@ public final class ApplyPatchSaveToFileExecutor implements ApplyPatchExecutor toOnePatchGroup(@NotNull MultiMap patchGroups, - @NotNull VirtualFile newPatchBase) throws IOException { + public static @NotNull List toOnePatchGroup(@NotNull MultiMap patchGroups, + @NotNull VirtualFile newPatchBase) throws IOException { List result = new ArrayList<>(); for (Map.Entry> entry : patchGroups.entrySet()) { @@ -108,17 +107,15 @@ public final class ApplyPatchSaveToFileExecutor implements ApplyPatchExecutor myTheirsChanges; - @NotNull private final List myTheirsBinaryChanges; + private final @NotNull List myTheirsChanges; + private final @NotNull List myTheirsBinaryChanges; private List myTextPatches; private final VirtualFile myBaseForPatch; private boolean myThereAreCreations; @@ -159,9 +159,9 @@ public final class MergeFromTheirsResolver extends BackgroundTaskGroup { } private class TreeConflictApplyTheirsPatchExecutor implements ApplyPatchExecutor { - @NotNull private final SvnVcs myVcs; + private final @NotNull SvnVcs myVcs; private final VirtualFile myBaseDir; - @NotNull private final AsyncPromise myPromise; + private final @NotNull AsyncPromise myPromise; TreeConflictApplyTheirsPatchExecutor(@NotNull SvnVcs vcs, final VirtualFile baseDir) { myVcs = vcs; @@ -293,8 +293,7 @@ public final class MergeFromTheirsResolver extends BackgroundTaskGroup { } } - @Nullable - private Collection chooseBinaryFiles(@NotNull List changes, @NotNull Set paths) { + private @Nullable Collection chooseBinaryFiles(@NotNull List changes, @NotNull Set paths) { return AbstractVcsHelper.getInstance(myVcs.getProject()).selectFilePathsToProcess( new ArrayList<>(paths), message("dialog.title.resolve.tree.conflict"), message("dialog.message.select.binary.files.to.patch"), @@ -314,8 +313,7 @@ public final class MergeFromTheirsResolver extends BackgroundTaskGroup { } @RequiresEdt - @NotNull - private List convertPaths(@NotNull List changes) throws VcsException { + private @NotNull List convertPaths(@NotNull List changes) throws VcsException { initAddOption(); List result = new ArrayList<>(); @@ -328,20 +326,17 @@ public final class MergeFromTheirsResolver extends BackgroundTaskGroup { return result; } - @Nullable - private ContentRevision convertBeforeRevision(@Nullable ContentRevision revision) throws VcsException { + private @Nullable ContentRevision convertBeforeRevision(@Nullable ContentRevision revision) throws VcsException { return revision != null ? toSimpleRevision(revision, true) : null; } - @Nullable - private ContentRevision convertAfterRevision(@NotNull Change change, @Nullable ContentRevision revision) throws VcsException { + private @Nullable ContentRevision convertAfterRevision(@NotNull Change change, @Nullable ContentRevision revision) throws VcsException { if (revision == null) return null; return myAdd && (change.getBeforeRevision() == null || change.isMoved() || change.isRenamed()) ? revision : toSimpleRevision(revision, true); } - @NotNull - private SimpleContentRevision toSimpleRevision(@NotNull ContentRevision revision, boolean rebasePath) throws VcsException { + private @NotNull SimpleContentRevision toSimpleRevision(@NotNull ContentRevision revision, boolean rebasePath) throws VcsException { return new SimpleContentRevision(revision.getContent(), rebasePath ? rebasePath(myOldFilePath, myNewFilePath, revision.getFile()) : myNewFilePath, revision.getRevisionNumber().asString()); @@ -355,8 +350,7 @@ public final class MergeFromTheirsResolver extends BackgroundTaskGroup { afterPath != null && isAncestor(path.getPath(), afterPath.getPath(), true); } - @NotNull - private static FilePath rebasePath(@NotNull FilePath oldBase, @NotNull FilePath newBase, @NotNull FilePath path) { + private static @NotNull FilePath rebasePath(@NotNull FilePath oldBase, @NotNull FilePath newBase, @NotNull FilePath path) { String relativePath = Objects.requireNonNull(getRelativePath(oldBase.getPath(), path.getPath(), '/')); return VcsUtil.getFilePath(newBase.getPath() + "/" + relativePath, path.isDirectory()); } @@ -461,9 +455,8 @@ public final class MergeFromTheirsResolver extends BackgroundTaskGroup { return true; } - @NotNull @Override - public String getDoNotShowMessage() { + public @NotNull String getDoNotShowMessage() { return IdeCoreBundle.message("dialog.options.do.not.ask"); } }) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java index 9e6dbb404781..66e562d0887b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/SvnTreeConflictResolver.java @@ -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 org.jetbrains.idea.svn.treeConflict; import com.intellij.history.LocalHistory; @@ -27,10 +27,10 @@ import static org.jetbrains.idea.svn.SvnBundle.message; public class SvnTreeConflictResolver { - @NotNull private final SvnVcs myVcs; - @NotNull private final FilePath myPath; - @Nullable private final FilePath myRevertPath; - @NotNull private final VcsDirtyScopeManager myDirtyScopeManager; + private final @NotNull SvnVcs myVcs; + private final @NotNull FilePath myPath; + private final @Nullable FilePath myRevertPath; + private final @NotNull VcsDirtyScopeManager myDirtyScopeManager; public SvnTreeConflictResolver(@NotNull SvnVcs vcs, @NotNull FilePath path, @Nullable FilePath revertPath) { myVcs = vcs; @@ -111,8 +111,7 @@ public class SvnTreeConflictResolver { } } - @NotNull - private Set getDescendantsWithAddedStatus(@NotNull File ioFile) throws SvnBindException { + private @NotNull Set getDescendantsWithAddedStatus(@NotNull File ioFile) throws SvnBindException { final Set result = new HashSet<>(); StatusClient statusClient = myVcs.getFactory(ioFile).createStatusClient(); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java index ce0f13165de6..1c7c02da31c5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/treeConflict/TreeConflictRefreshablePanel.java @@ -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 org.jetbrains.idea.svn.treeConflict; import com.intellij.openapi.CompositeDisposable; @@ -56,8 +56,8 @@ public final class TreeConflictRefreshablePanel implements Disposable { private final FilePath myPath; private final CompositeDisposable myChildDisposables = new CompositeDisposable(); private final LongArrayList myRightRevisionsList; - @NotNull private final JBLoadingPanel myDetailsPanel; - @NotNull private final BackgroundTaskQueue myQueue; + private final @NotNull JBLoadingPanel myDetailsPanel; + private final @NotNull BackgroundTaskQueue myQueue; private volatile ProgressIndicator myIndicator = new EmptyProgressIndicator(); public TreeConflictRefreshablePanel(@NotNull Project project, @NotNull BackgroundTaskQueue queue, @NotNull ConflictedSvnChange change) { @@ -91,8 +91,7 @@ public final class TreeConflictRefreshablePanel implements Disposable { return true; } - @NotNull - public JPanel getPanel() { + public @NotNull JPanel getPanel() { return myDetailsPanel; } @@ -126,8 +125,7 @@ public final class TreeConflictRefreshablePanel implements Disposable { return new BeforeAfter<>(leftSide, rightSide); } - @Nullable - private Revision getPegRevisionFromLeftSide(@NotNull TreeConflictDescription description) { + private @Nullable Revision getPegRevisionFromLeftSide(@NotNull TreeConflictDescription description) { Revision result = null; if (description.getSourceLeftVersion() != null) { long committed = description.getSourceLeftVersion().getPegRevision(); @@ -146,8 +144,7 @@ public final class TreeConflictRefreshablePanel implements Disposable { !Objects.equals(description.getSourceLeftVersion().getPath(), description.getSourceRightVersion().getPath()); } - @NotNull - private ConflictSidePresentation createSide(@Nullable ConflictVersion version, @Nullable Revision untilThisOther, boolean isLeft) + private @NotNull ConflictSidePresentation createSide(@Nullable ConflictVersion version, @Nullable Revision untilThisOther, boolean isLeft) throws VcsException { ConflictSidePresentation result = EmptyConflictSide.INSTANCE; if (version != null && @@ -366,8 +363,7 @@ public final class TreeConflictRefreshablePanel implements Disposable { return e -> new MergeFromTheirsResolver(myVcs, description, myChange, myCommittedRevision).execute(); } - @NotNull - public static String filePath(@NotNull FilePath newFilePath) { + public static @NotNull String filePath(@NotNull FilePath newFilePath) { return newFilePath.getName() + " (" + Objects.requireNonNull(newFilePath.getParentPath()).getPath() + ")"; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdateIntegrateEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdateIntegrateEnvironment.java index 55e25338570e..6b0ee1369c16 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdateIntegrateEnvironment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdateIntegrateEnvironment.java @@ -32,7 +32,7 @@ import java.util.stream.Collectors; public abstract class AbstractSvnUpdateIntegrateEnvironment implements UpdateEnvironment { protected final SvnVcs myVcs; private final ProjectLevelVcsManager myVcsManager; - @NonNls public static final String REPLACED_ID = "replaced"; + public static final @NonNls String REPLACED_ID = "replaced"; protected AbstractSvnUpdateIntegrateEnvironment(final SvnVcs vcs) { myVcs = vcs; @@ -50,10 +50,9 @@ public abstract class AbstractSvnUpdateIntegrateEnvironment implements UpdateEnv } @Override - @NotNull - public UpdateSession updateDirectories(final FilePath @NotNull [] contentRoots, - final UpdatedFiles updatedFiles, - final ProgressIndicator progressIndicator, @NotNull final Ref context) + public @NotNull UpdateSession updateDirectories(final FilePath @NotNull [] contentRoots, + final UpdatedFiles updatedFiles, + final ProgressIndicator progressIndicator, final @NotNull Ref context) throws ProcessCanceledException { if (context.isNull()) { @@ -225,8 +224,7 @@ public abstract class AbstractSvnUpdateIntegrateEnvironment implements UpdateEnv return writable; } - @Nullable - protected abstract List merge(); + protected abstract @Nullable List merge(); @Override public void run() { @@ -292,6 +290,5 @@ public abstract class AbstractSvnUpdateIntegrateEnvironment implements UpdateEnv ArrayList exceptions, UpdatedFiles updatedFiles); @Override - @Nullable - public abstract Configurable createConfigurable(Collection collection); + public abstract @Nullable Configurable createConfigurable(Collection collection); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java index 543797321efc..48ae676f2dc7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractSvnUpdatePanel.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.options.ConfigurationException; @@ -93,8 +93,7 @@ public abstract class AbstractSvnUpdatePanel { } } - @Nullable - private Url getUrlFor(@NotNull final FilePath root) { + private @Nullable Url getUrlFor(final @NotNull FilePath root) { final Info info = myVCS.getInfo(root.getIOFile()); return info != null ? info.getUrl() : null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java index ab3465be8bd4..80da59d22e89 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AbstractUpdateIntegrateCrawler.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.diagnostic.Logger; @@ -19,7 +19,7 @@ public abstract class AbstractUpdateIntegrateCrawler implements SvnWCRootCrawler protected final Collection myExceptions; protected final UpdatedFiles myPostUpdateFiles; protected final boolean myIsTotalUpdate; - private final static Logger LOG = Logger.getInstance(AbstractUpdateIntegrateCrawler.class); + private static final Logger LOG = Logger.getInstance(AbstractUpdateIntegrateCrawler.class); protected AbstractUpdateIntegrateCrawler( final boolean isTotalUpdate, diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java index 3a1354695530..16076cafd52d 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/AutoSvnUpdater.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.ide.DataManager; @@ -65,7 +65,7 @@ public class AutoSvnUpdater extends AbstractCommonUpdateAction { } private static class BlindUpdateAction implements ActionInfo { - private final static BlindUpdateAction ourInstance = new BlindUpdateAction(); + private static final BlindUpdateAction ourInstance = new BlindUpdateAction(); @Override public boolean showOptions(Project project) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java index 208ae6956916..7d0e763aa473 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/CmdUpdateClient.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.util.io.FileUtil; @@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicReference; public class CmdUpdateClient extends BaseSvnClient implements UpdateClient { - @Nullable private ProgressTracker myDispatcher; + private @Nullable ProgressTracker myDispatcher; private boolean myIgnoreExternals; @Override diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MultipleRootEditorWithSplitter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MultipleRootEditorWithSplitter.java index 8a229a011448..28009d1255c4 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MultipleRootEditorWithSplitter.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/MultipleRootEditorWithSplitter.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.project.Project; @@ -23,7 +23,7 @@ import static com.intellij.openapi.util.io.FileUtil.join; public class MultipleRootEditorWithSplitter extends JPanel { private final JList myList; private final JPanel myConfigureRootPanel; - @NonNls private static final String EMPTY = "empty"; + private static final @NonNls String EMPTY = "empty"; public MultipleRootEditorWithSplitter(final Map rootToPanel, final Project project) { super(new BorderLayout()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SingleRootSwitcher.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SingleRootSwitcher.java index 653003321115..37a7455e4976 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SingleRootSwitcher.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SingleRootSwitcher.java @@ -1,4 +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 org.jetbrains.idea.svn.update; import com.intellij.openapi.project.Project; @@ -8,7 +8,7 @@ import org.jetbrains.idea.svn.api.Url; public class SingleRootSwitcher extends AutoSvnUpdater { - @NotNull private final Url myUrl; + private final @NotNull Url myUrl; public SingleRootSwitcher(Project project, @NotNull FilePath root, @NotNull Url url) { super(project, new FilePath[]{root}); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateRootOptionsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateRootOptionsPanel.java index e12f6c9cbb30..736405937a49 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateRootOptionsPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateRootOptionsPanel.java @@ -1,4 +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 org.jetbrains.idea.svn.update; import com.intellij.openapi.options.ConfigurationException; @@ -25,8 +25,8 @@ public class SvnIntegrateRootOptionsPanel implements SvnPanel{ private SvnRevisionPanel myRevision2; private SvnRevisionPanel myRevision1; - @NotNull private final FilePath myRoot; - @NotNull private final SvnVcs myVcs; + private final @NotNull FilePath myRoot; + private final @NotNull SvnVcs myVcs; public SvnIntegrateRootOptionsPanel(@NotNull SvnVcs vcs, @NotNull FilePath root) { myRoot = root; @@ -90,8 +90,7 @@ public class SvnIntegrateRootOptionsPanel implements SvnPanel{ } @Override - @NotNull - public JPanel getPanel() { + public @NotNull JPanel getPanel() { return myPanel; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnRevisionPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnRevisionPanel.java index 87f6ea906112..30eb82b0080e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnRevisionPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnRevisionPanel.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.options.ConfigurationException; @@ -66,7 +66,7 @@ public class SvnRevisionPanel extends JPanel { myRevisionField.getTextField().setColumns(10); myRevisionField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() { @Override - protected void textChanged(@NotNull final DocumentEvent e) { + protected void textChanged(final @NotNull DocumentEvent e) { notifyChangeListeners(); } }); @@ -103,8 +103,7 @@ public class SvnRevisionPanel extends JPanel { return myHead.isSelected() ? Revision.HEAD.toString() : myRevisionField.getText(); } - @NotNull - public Revision getRevision() throws ConfigurationException { + public @NotNull Revision getRevision() throws ConfigurationException { if (myHead.isSelected()) return Revision.HEAD; @@ -116,8 +115,7 @@ public class SvnRevisionPanel extends JPanel { return result; } - @NotNull - public JTextField getRevisionTextField() { + public @NotNull JTextField getRevisionTextField() { return myRevisionField.getTextField(); } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnSelectRevisionUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnSelectRevisionUtil.java index b7e6d2b2a692..cb86e8918500 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnSelectRevisionUtil.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnSelectRevisionUtil.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.project.Project; @@ -17,9 +17,8 @@ public final class SvnSelectRevisionUtil { private SvnSelectRevisionUtil() { } - @Nullable - public static SvnChangeList chooseCommittedChangeList(final Project project, final SvnRepositoryLocation location, - final VirtualFile root) { + public static @Nullable SvnChangeList chooseCommittedChangeList(final Project project, final SvnRepositoryLocation location, + final VirtualFile root) { try { final SvnCommittedChangesTableModel model = new SvnCommittedChangesTableModel(location, project, root, SvnVcs.getInstance(project) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateConfigurable.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateConfigurable.java index 067b48308d79..097bcfd52bdb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateConfigurable.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateConfigurable.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.options.Configurable; @@ -10,7 +10,7 @@ import org.jetbrains.idea.svn.SvnConfiguration; import javax.swing.*; public abstract class SvnUpdateConfigurable implements Configurable { - @NonNls private static final String HELP_ID = "vcs.subversion.updateProject"; + private static final @NonNls String HELP_ID = "vcs.subversion.updateProject"; private AbstractSvnUpdatePanel myPanel; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateContext.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateContext.java index 82ba8d58e427..8fcbf7af848b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateContext.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateContext.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.vcs.FilePath; @@ -31,8 +31,7 @@ public class SvnUpdateContext implements SequentialUpdatesContext { } @Override - @NotNull - public String getMessageWhenInterruptedBeforeStart() { + public @NotNull String getMessageWhenInterruptedBeforeStart() { // never return null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java index 421642e27251..3a1cdb570969 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateEnvironment.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.options.Configurable; @@ -105,8 +105,7 @@ public class SvnUpdateEnvironment extends AbstractSvnUpdateIntegrateEnvironment } } - @Nullable - private static Url getSourceUrl(final SvnVcs vcs, final File root) { + private static @Nullable Url getSourceUrl(final SvnVcs vcs, final File root) { final Info svnInfo = vcs.getInfo(root); return svnInfo != null ? svnInfo.getUrl() : null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateRootOptionsPanel.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateRootOptionsPanel.java index e6050b64578c..f08c2948fed1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateRootOptionsPanel.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnUpdateRootOptionsPanel.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.diagnostic.Logger; @@ -27,7 +27,7 @@ import static org.jetbrains.idea.svn.SvnBundle.message; import static org.jetbrains.idea.svn.SvnUtil.createUrl; public class SvnUpdateRootOptionsPanel implements SvnPanel{ - private final static Logger LOG = Logger.getInstance(SvnUpdateRootOptionsPanel.class); + private static final Logger LOG = Logger.getInstance(SvnUpdateRootOptionsPanel.class); private TextFieldWithBrowseButton myURLText; private JCheckBox myRevisionBox; private TextFieldWithBrowseButton myRevisionText; @@ -40,7 +40,7 @@ public class SvnUpdateRootOptionsPanel implements SvnPanel{ private JLabel myBranchLabel; private JLabel myUrlLabel; private JLabel myCopyType; - @Nullable private Url mySourceUrl; + private @Nullable Url mySourceUrl; public SvnUpdateRootOptionsPanel(FilePath root, final SvnVcs vcs, Collection roots) { myRoot = root; @@ -163,15 +163,13 @@ public class SvnUpdateRootOptionsPanel implements SvnPanel{ return myPanel; } - @Nullable - private Url getBranchForUrl(@Nullable Url url) { + private @Nullable Url getBranchForUrl(@Nullable Url url) { final RootUrlInfo rootInfo = myVcs.getSvnFileUrlMapping().getWcRootForFilePath(myRoot); return rootInfo != null && url != null ? SvnUtil.getBranchForUrl(myVcs, rootInfo.getVirtualFile(), url) : null; } - @Nullable - private SvnBranchConfigurationNew getBranchConfiguration() { + private @Nullable SvnBranchConfigurationNew getBranchConfiguration() { final RootUrlInfo rootInfo = myVcs.getSvnFileUrlMapping().getWcRootForFilePath(myRoot); return rootInfo != null ? SvnBranchConfigurationManager.getInstance(myVcs.getProject()).get(rootInfo.getVirtualFile()) : null; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java index 18df1cc750a1..3bfd3d1598a1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateEventHandler.java @@ -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 org.jetbrains.idea.svn.update; import com.intellij.openapi.progress.ProcessCanceledException; @@ -35,7 +35,7 @@ public class UpdateEventHandler implements ProgressTracker { private UpdatedFiles myUpdatedFiles; private int myExternalsCount; private final SvnVcs myVCS; - @Nullable private final SvnUpdateContext mySequentialUpdatesContext; + private final @Nullable SvnUpdateContext mySequentialUpdatesContext; private final Map myUrlToCheckForSwitch; // pair.first - group id, pair.second - file path // Stack is used to correctly handle cases when updates of externals occur during ordinary update, because these inner updates could have @@ -46,7 +46,7 @@ public class UpdateEventHandler implements ProgressTracker { protected @NlsContexts.ProgressDetails @Nullable String myText2; public UpdateEventHandler(SvnVcs vcs, ProgressIndicator progressIndicator, - @Nullable final SvnUpdateContext sequentialUpdatesContext) { + final @Nullable SvnUpdateContext sequentialUpdatesContext) { myProgressIndicator = progressIndicator; myVCS = vcs; mySequentialUpdatesContext = sequentialUpdatesContext; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java index 1d5333f7ebc8..e66478d7b32f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/UpdateRootInfo.java @@ -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 org.jetbrains.idea.svn.update; import org.jetbrains.annotations.NotNull; @@ -11,7 +11,7 @@ import org.jetbrains.idea.svn.info.Info; import java.io.File; public class UpdateRootInfo { - @Nullable private Url myUrl; + private @Nullable Url myUrl; private Revision myRevision; private boolean myUpdateToSpecifiedRevision = false; @@ -22,8 +22,7 @@ public class UpdateRootInfo { myUrl = info != null ? info.getUrl() : null; } - @Nullable - public Url getUrl() { + public @Nullable Url getUrl() { return myUrl; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java index 93dc8f75249a..73b3fdf08976 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/upgrade/CmdUpgradeClient.java @@ -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 org.jetbrains.idea.svn.upgrade; import com.intellij.execution.process.ProcessOutputTypes; @@ -69,8 +69,7 @@ public class CmdUpgradeClient extends BaseSvnClient implements UpgradeClient { return createEvent(new File(path), createAction(statusMessage)); } - @Nullable - public static EventAction createAction(@NotNull String code) { + public static @Nullable EventAction createAction(@NotNull String code) { EventAction result = null; if (UPGRADED_CODE.equals(code)) { @@ -83,8 +82,8 @@ public class CmdUpgradeClient extends BaseSvnClient implements UpgradeClient { private static final class UpgradeLineCommandListener extends LineCommandAdapter { - @NotNull private final FileStatusResultParser parser; - @NotNull private final AtomicReference exception; + private final @NotNull FileStatusResultParser parser; + private final @NotNull AtomicReference exception; private UpgradeLineCommandListener(@NotNull FileStatusResultParser parser) { this.parser = parser;