mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[multiple] Cleanup: use case null
GitOrigin-RevId: da8a48447029016c410d7f6886c3888c6bd06171
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e67800afb2
commit
c387faa3f6
@@ -463,8 +463,8 @@ public class GridUtil extends GridUtilCore {
|
||||
}
|
||||
|
||||
public static @Nullable CellAttributesKey getMutationCellAttributes(@Nullable MutationType type) {
|
||||
if (type == null) return null;
|
||||
return switch (type) {
|
||||
case null -> null;
|
||||
case MODIFY -> CellColors.REPLACE;
|
||||
case INSERT -> CellColors.INSERT;
|
||||
case DELETE -> CellColors.REMOVE;
|
||||
|
||||
+1
-2
@@ -504,7 +504,6 @@ public final class HardcodedContracts {
|
||||
if (!(expr instanceof PsiMethodCallExpression call)) return null;
|
||||
String calledName = call.getMethodExpression().getReferenceName();
|
||||
PsiExpression[] args = call.getArgumentList().getExpressions();
|
||||
if (calledName == null) return null;
|
||||
return switch (calledName) {
|
||||
case "array", "arrayWithSize", "arrayContaining", "arrayContainingInAnyOrder", "contains", "containsInAnyOrder", "containsString",
|
||||
"endsWith", "startsWith", "stringContainsInOrder", "empty", "emptyArray", "emptyCollectionOf", "emptyIterable", "emptyIterableOf",
|
||||
@@ -531,7 +530,7 @@ public final class HardcodedContracts {
|
||||
}
|
||||
yield null;
|
||||
}
|
||||
default -> null;
|
||||
case null, default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -357,7 +357,6 @@ public final class TypeConstraints {
|
||||
@Override
|
||||
public DfType getUnboxedType() {
|
||||
String name = classDef.getQualifiedName();
|
||||
if (name == null) return DfType.BOTTOM;
|
||||
return switch (name) {
|
||||
case JAVA_LANG_BOOLEAN -> DfTypes.BOOLEAN;
|
||||
case JAVA_LANG_INTEGER -> DfTypes.INT;
|
||||
@@ -367,7 +366,7 @@ public final class TypeConstraints {
|
||||
case JAVA_LANG_BYTE -> DfTypes.intRange(Objects.requireNonNull(JvmPsiRangeSetUtil.typeRange(PsiTypes.byteType())));
|
||||
case JAVA_LANG_SHORT -> DfTypes.intRange(Objects.requireNonNull(JvmPsiRangeSetUtil.typeRange(PsiTypes.shortType())));
|
||||
case JAVA_LANG_CHARACTER -> DfTypes.intRange(Objects.requireNonNull(JvmPsiRangeSetUtil.typeRange(PsiTypes.charType())));
|
||||
default -> DfType.BOTTOM;
|
||||
case null, default -> DfType.BOTTOM;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1584,12 +1584,11 @@ public final class SimplifyStreamApiCallChainsInspection extends AbstractBaseJav
|
||||
|
||||
private static String getStreamClassName(@NotNull PsiMethodCallExpression call) {
|
||||
String name = MethodCallUtils.getMethodName(call);
|
||||
if (name == null) return JAVA_UTIL_STREAM_STREAM;
|
||||
return switch (name) {
|
||||
case "mapToInt" -> JAVA_UTIL_STREAM_INT_STREAM;
|
||||
case "mapToLong" -> JAVA_UTIL_STREAM_LONG_STREAM;
|
||||
case "mapToDouble" -> JAVA_UTIL_STREAM_DOUBLE_STREAM;
|
||||
default -> JAVA_UTIL_STREAM_STREAM;
|
||||
case null, default -> JAVA_UTIL_STREAM_STREAM;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,13 +91,12 @@ public class WrapWithMutableCollectionFix extends PsiUpdateModCommandQuickFix {
|
||||
PsiClass aClass = ((PsiClassType)type).resolve();
|
||||
if (aClass == null) return null;
|
||||
String name = aClass.getQualifiedName();
|
||||
if (name == null) return null;
|
||||
return switch (name) {
|
||||
case CommonClassNames.JAVA_LANG_ITERABLE, CommonClassNames.JAVA_UTIL_COLLECTION, CommonClassNames.JAVA_UTIL_LIST ->
|
||||
CommonClassNames.JAVA_UTIL_ARRAY_LIST;
|
||||
case CommonClassNames.JAVA_UTIL_SET -> CommonClassNames.JAVA_UTIL_HASH_SET;
|
||||
case CommonClassNames.JAVA_UTIL_MAP -> CommonClassNames.JAVA_UTIL_HASH_MAP;
|
||||
default -> null;
|
||||
case null, default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,12 +168,11 @@ public final class ExcessiveRangeCheckInspection extends AbstractBaseJavaLocalIn
|
||||
}
|
||||
|
||||
@NonNls String getExpressionSuffix() {
|
||||
if (myField == null) return "";
|
||||
return switch (myField) {
|
||||
case ARRAY_LENGTH -> ".length";
|
||||
case STRING_LENGTH -> ".length()";
|
||||
case COLLECTION_SIZE -> ".size()";
|
||||
default -> "";
|
||||
case null, default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -51,8 +51,8 @@ public final class ExternalSystemJdkUtil {
|
||||
|
||||
@Contract("_, null -> null")
|
||||
public static @Nullable Sdk resolveJdkName(@Nullable Sdk projectSdk, @Nullable String jdkName) throws ExternalSystemJdkException {
|
||||
if (jdkName == null) return null;
|
||||
return switch (jdkName) {
|
||||
case null -> null;
|
||||
case USE_INTERNAL_JAVA -> getInternalJdk();
|
||||
case USE_PROJECT_JDK -> {
|
||||
if (projectSdk == null) {
|
||||
|
||||
+1
-2
@@ -50,13 +50,12 @@ public final class DefaultIntentionsOrderProvider implements IntentionsOrderProv
|
||||
}
|
||||
|
||||
public static int getPriorityWeight(@Nullable Priority priority) {
|
||||
if (priority == null) return 0;
|
||||
return switch (priority) {
|
||||
case TOP -> 20;
|
||||
case HIGH -> 3;
|
||||
case LOW -> -3;
|
||||
case BOTTOM -> -20;
|
||||
default -> 0;
|
||||
case null, default -> 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.intellij.ide.plugins.enums.PluginsGroupType;
|
||||
import com.intellij.ide.plugins.enums.SortBy;
|
||||
import com.intellij.ide.plugins.marketplace.CheckErrorsResult;
|
||||
import com.intellij.ide.plugins.marketplace.PluginSearchResult;
|
||||
import com.intellij.ide.plugins.newui.UiPluginManager;
|
||||
import com.intellij.ide.plugins.marketplace.ranking.MarketplaceLocalRanker;
|
||||
import com.intellij.ide.plugins.marketplace.statistics.PluginManagerUsageCollector;
|
||||
import com.intellij.ide.plugins.newui.*;
|
||||
@@ -41,7 +40,10 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.ui.popup.JBPopupListener;
|
||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.openapi.updateSettings.impl.*;
|
||||
import com.intellij.openapi.updateSettings.impl.PluginAutoUpdateListener;
|
||||
import com.intellij.openapi.updateSettings.impl.PluginAutoUpdateService;
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateOptions;
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
|
||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.FUSEventSource;
|
||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiserStartupActivityKt;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -50,7 +52,10 @@ import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.GotItTooltip;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.RelativeFont;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.ui.components.fields.ExtendableTextComponent;
|
||||
@@ -681,7 +686,6 @@ public final class PluginManagerConfigurable
|
||||
@Override
|
||||
protected @Nullable List<String> getValues(@NotNull String attribute) {
|
||||
SearchWords word = SearchWords.find(attribute);
|
||||
if (word == null) return null;
|
||||
return switch (word) {
|
||||
case TAG -> {
|
||||
if (myTagsSorted == null || myTagsSorted.isEmpty()) {
|
||||
@@ -723,6 +727,7 @@ public final class PluginManagerConfigurable
|
||||
}
|
||||
case REPOSITORY -> RepositoryHelper.getCustomPluginRepositoryHosts();
|
||||
case INTERNAL, SUGGESTED, STAFF_PICKS -> null;
|
||||
case null -> null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,10 @@ public class TestStatusLine extends NonOpaquePanel {
|
||||
|
||||
myConverter = new HtmlToSimpleColoredComponentConverter((tag, attr) -> {
|
||||
final String className = (String) attr.getAttribute(HTML.Attribute.CLASS);
|
||||
if (className == null) return SimpleTextAttributes.REGULAR_ATTRIBUTES;
|
||||
return switch (className) {
|
||||
case "failed" -> FAILED_ATTRIBUTES;
|
||||
case "ignored" -> IGNORED_ATTRIBUTES;
|
||||
default -> SimpleTextAttributes.REGULAR_ATTRIBUTES;
|
||||
case null, default -> SimpleTextAttributes.REGULAR_ATTRIBUTES;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -139,12 +139,11 @@ public class TracRepository extends BaseRepositoryImpl {
|
||||
@Override
|
||||
public @NotNull TaskType getType() {
|
||||
String type = map.get("type");
|
||||
if (type == null) return TaskType.OTHER;
|
||||
return switch (type) {
|
||||
case "Feature", "enhancement" -> TaskType.FEATURE;
|
||||
case "Bug", "defect", "error" -> TaskType.BUG;
|
||||
case "Exception" -> TaskType.EXCEPTION;
|
||||
default -> TaskType.OTHER;
|
||||
case null, default -> TaskType.OTHER;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user