[platform util] API cleanup: mark deprecated unused API for removal (IJPL-163936)

GitOrigin-RevId: 5a3e117a6b698b1a0bdbe5e8a490747b55ae1aad
This commit is contained in:
Nikolay Chashnikov
2025-02-14 12:51:54 +01:00
committed by intellij-monorepo-bot
parent d3bc6c3dac
commit 627b6de614
10 changed files with 20 additions and 6 deletions

View File

@@ -17,24 +17,28 @@ import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.ApiStatus.Internal
import kotlin.time.Duration
@ApiStatus.ScheduledForRemoval
@Deprecated("Moved to com.intellij.platform.util.coroutines.flow", level = DeprecationLevel.ERROR)
@Internal
fun <X> Flow<X>.throttle(timeMs: Long): Flow<X> {
return throttle(timeMs)
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Moved to com.intellij.platform.util.coroutines.flow", level = DeprecationLevel.ERROR)
@Internal
suspend fun <X> SharedFlow<X>.collectLatestUndispatched(action: suspend (value: X) -> Unit) {
collectLatestUndispatched(action)
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Moved to com.intellij.platform.util.coroutines.flow", level = DeprecationLevel.ERROR)
@Internal
fun <T, R> Flow<T>.zipWithNext(transform: suspend (a: T, b: T) -> R): Flow<R> {
return zipWithNext(transform)
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Moved to com.intellij.platform.util.coroutines.flow", level = DeprecationLevel.ERROR)
@Internal
fun <T> Flow<T>.zipWithNext(): Flow<Pair<T, T>> {
@@ -47,7 +51,7 @@ fun <T> Flow<T>.debounceBatch(duration: Duration): Flow<List<T>> {
return debounceBatch(duration)
}
@ApiStatus.Experimental
@ApiStatus.ScheduledForRemoval
@Deprecated("Moved to com.intellij.platform.util.coroutines.flow", level = DeprecationLevel.ERROR)
@Internal
fun <T, M> StateFlow<T>.mapStateIn(

View File

@@ -182,6 +182,7 @@ fun generateRandomPath(parentDirectory: Path): Path {
}
//<editor-fold desc="Deprecated stuff.">
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Use kotlin.io.path.readText", level = DeprecationLevel.ERROR)
@Suppress("DeprecatedCallableAddReplaceWith")
@Throws(IOException::class)
@@ -204,6 +205,7 @@ fun Path.isDirectory(): Boolean = isDirectory()
@Suppress("DeprecatedCallableAddReplaceWith")
fun Path.isFile(): Boolean = isRegularFile()
@ApiStatus.ScheduledForRemoval
@Deprecated(message = "Use kotlin.io.path.fileSize", level = DeprecationLevel.ERROR)
@Suppress("DeprecatedCallableAddReplaceWith")
fun Path.size(): Long = fileSize()

View File

@@ -115,6 +115,7 @@ public final class Comparing {
/**
* @deprecated use {@link Boolean#compare(boolean, boolean)} instead
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
public static int compare(boolean o1, boolean o2) {
return Boolean.compare(o1, o2);

View File

@@ -7,6 +7,7 @@ import com.intellij.util.ArrayUtilRt;
import com.intellij.util.xmlb.Constants;
import com.intellij.util.xmlb.XmlSerializer;
import org.jdom.Element;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -46,6 +47,7 @@ public final class JDOMExternalizer {
/**
* @deprecated Use {@link XmlSerializer} instead.
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
public static void write(Element root, String name, int value) {
write(root, name, Integer.toString(value));

View File

@@ -3,10 +3,7 @@ package com.intellij.util;
import com.intellij.openapi.util.NotNullFactory;
import com.intellij.util.containers.Convertor;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
import java.util.Comparator;
import java.util.List;
@@ -144,6 +141,7 @@ public final class ObjectUtils {
/**
* @deprecated Use {@code if (obj != null) ...} instead
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
public static <T> void consumeIfNotNull(@Nullable T obj, @NotNull Consumer<? super T> consumer) {
if (obj != null) {
@@ -171,6 +169,7 @@ public final class ObjectUtils {
/**
* @deprecated Use Kotlin takeIf
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
public static @Nullable <T> T nullizeIfDefaultValue(@Nullable T obj, @NotNull T defaultValue) {
return obj == defaultValue ? null : obj;

View File

@@ -51,6 +51,7 @@ fun ByteBuffer.toByteArray(isClear: Boolean = false): ByteArray {
return bytes
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Use URLEncoder.encode()")
@Suppress("DeprecatedCallableAddReplaceWith", "NOTHING_TO_INLINE")
inline fun String.encodeUrlQueryParameter(): String = URLEncoder.encode(this, Charsets.UTF_8.name())!!

View File

@@ -22,6 +22,7 @@ import com.intellij.util.ui.ImageUtil
import com.intellij.util.ui.StartupUiUtil
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.asExecutor
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.ApiStatus.Internal
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.TestOnly
@@ -257,6 +258,7 @@ object IconLoader {
@JvmStatic
fun getDisabledIcon(icon: Icon): Icon = getDisabledIcon(icon = icon, disableFilter = null)
@ApiStatus.ScheduledForRemoval
@Deprecated("Use com.intellij.ui.svg.colorPatchedIcon")
@Internal
fun colorPatchedIcon(icon: Icon, colorPatcher: SvgElementColorPatcherProvider): Icon {

View File

@@ -10,6 +10,7 @@ import com.intellij.ui.scale.ScaleContext
import com.intellij.util.ui.ImageUtil
import com.intellij.util.ui.StartupUiUtil
import org.imgscalr.Scalr
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.NonNls
import java.awt.Image
import java.awt.image.BufferedImage
@@ -111,6 +112,7 @@ object ImageLoader {
}
@Suppress("unused")
@ApiStatus.ScheduledForRemoval
@Deprecated("Do not use")
class Dimension2DDouble(var width: Double, var height: Double) {
fun setSize(@Suppress("DEPRECATION") size: Dimension2DDouble) {

View File

@@ -43,6 +43,7 @@ open class JBHiDPIScaledImage : BufferedImage {
this.scale = scale
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Use IconManager instead.")
constructor(image: Image, width: Int, height: Int, type: Int) : this(image = image,
width = width.toDouble(),

View File

@@ -30,7 +30,7 @@ public final class NamedColorUtil {
/**
* @deprecated use {@link Cursor#getPredefinedCursor(int)} with {@link Cursor#TEXT_CURSOR} argument instead.
*/
@Deprecated
@Deprecated(forRemoval = true)
public static @NotNull Cursor getTextCursor(@NotNull Color backgroundColor) {
return SystemInfoRt.isMac && ColorUtil.isDark(backgroundColor) ?
MacUIUtil.getInvertedTextCursor() : Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);