From 832ceab2b4e4a44546600777bbfb00f3a1d973bd Mon Sep 17 00:00:00 2001 From: Vladimir Lagunov Date: Wed, 11 Jun 2025 13:36:49 +0200 Subject: [PATCH] IJPL-172897 Eel: Remove package-info.java files, put explicit ApiStatus annotations Although all entities remained internal, it's now easier to review every entity separately. GitOrigin-RevId: 21db402317f446abe16f7b32b30ee8015db2c9da --- .../eel/provider/EelNioBridgeService.kt | 8 +++ .../platform/eel/provider/EelProvider.kt | 10 ++++ .../platform/eel/provider/package-info.java | 8 --- .../platform/eel/provider/utils/JEelUtils.kt | 2 + .../eel/provider/utils/eelChannelTextUtils.kt | 6 +- .../eel/provider/utils/eelChannelUtils.kt | 18 ++++++ .../eel/provider/utils/eelProcessUtils.kt | 6 ++ .../eel/provider/utils/eelTunnelUtils.kt | 4 ++ .../platform/eel/provider/utils/eelUtils.kt | 6 ++ .../eel/provider/utils/package-info.java | 8 --- platform/eel/codegen/BuildersGeneratorTest.kt | 59 +++++++++++++++++-- .../platform/eel/EelExecApiHelpers.kt | 7 +++ .../platform/eel/EelExecPosixApiHelpers.kt | 4 ++ .../platform/eel/EelExecWindowsApiHelpers.kt | 4 ++ .../platform/eel/EelTunnelsApiHelpers.kt | 6 ++ .../eel/ExecuteProcessOptionsBuilder.kt | 2 + .../eel/GetAcceptorForRemotePortBuilder.kt | 2 + .../GetConnectionToRemotePortArgsBuilder.kt | 2 + .../eel/fs/ChangeAttributesOptionsBuilder.kt | 2 + .../platform/eel/fs/CopyOptionsBuilder.kt | 2 + .../fs/CreateTemporaryEntryOptionsBuilder.kt | 2 + .../eel/fs/EelFileSystemApiHelpers.kt | 24 ++++++++ .../eel/fs/EelFileSystemPosixApiHelpers.kt | 6 ++ .../eel/fs/EelFileSystemWindowsApiHelpers.kt | 6 ++ .../fs/ListDirectoryWithAttrsArgsBuilder.kt | 2 + .../platform/eel/fs/MoveArgsBuilder.kt | 2 + .../platform/eel/fs/StatArgsBuilder.kt | 2 + .../platform/eel/fs/UnwatchOptionsBuilder.kt | 2 + .../platform/eel/fs/WatchOptionsBuilder.kt | 2 + .../platform/eel/fs/WriteOptionsBuilder.kt | 2 + .../src/com/intellij/platform/eel/EelApi.kt | 5 ++ .../intellij/platform/eel/EelArchiveApi.kt | 2 + .../intellij/platform/eel/EelDescriptor.kt | 2 + .../com/intellij/platform/eel/EelException.kt | 1 + .../com/intellij/platform/eel/EelExecApi.kt | 8 +++ .../intellij/platform/eel/EelIpPreference.kt | 3 + .../com/intellij/platform/eel/EelPlatform.kt | 12 ++++ .../com/intellij/platform/eel/EelProcess.kt | 5 +- .../com/intellij/platform/eel/EelResult.kt | 6 ++ .../intellij/platform/eel/EelTunnelsApi.kt | 16 +++++ .../com/intellij/platform/eel/EelUserInfo.kt | 4 ++ .../platform/eel/ExecuteProcessException.kt | 2 + .../intellij/platform/eel/GeneratedBuilder.kt | 4 ++ .../com/intellij/platform/eel/ReadResult.kt | 2 + .../intellij/platform/eel/ThrowsChecked.kt | 2 +- .../platform/eel/annotations/Paths.kt | 6 ++ .../eel/annotations/package-info.java | 5 -- .../platform/eel/channels/EelLowLevelApi.kt | 3 + .../eel/channels/EelReceiveChannel.kt | 3 +- .../platform/eel/channels/EelSendChannel.kt | 4 +- .../platform/eel/channels/package-info.java | 10 ---- .../intellij/platform/eel/fs/EelFileInfo.kt | 4 ++ .../platform/eel/fs/EelFileSystemApi.kt | 14 +++++ .../intellij/platform/eel/fs/EelFsError.kt | 2 + .../platform/eel/fs/EelPosixFileInfoImpl.kt | 2 + .../platform/eel/fs/package-info.java | 8 --- .../intellij/platform/eel/package-info.java | 8 --- .../com/intellij/platform/eel/path/EelPath.kt | 5 ++ .../platform/eel/path/package-info.java | 5 -- 59 files changed, 305 insertions(+), 64 deletions(-) delete mode 100644 platform/eel-provider/src/com/intellij/platform/eel/provider/package-info.java delete mode 100644 platform/eel-provider/src/com/intellij/platform/eel/provider/utils/package-info.java delete mode 100644 platform/eel/src/com/intellij/platform/eel/annotations/package-info.java delete mode 100644 platform/eel/src/com/intellij/platform/eel/channels/package-info.java delete mode 100644 platform/eel/src/com/intellij/platform/eel/fs/package-info.java delete mode 100644 platform/eel/src/com/intellij/platform/eel/package-info.java delete mode 100644 platform/eel/src/com/intellij/platform/eel/path/package-info.java diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/EelNioBridgeService.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/EelNioBridgeService.kt index c25c540e18aa..130c3f930fa9 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/EelNioBridgeService.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/EelNioBridgeService.kt @@ -11,6 +11,7 @@ import com.intellij.platform.eel.EelDescriptor import com.intellij.platform.eel.EelPlatform import com.intellij.platform.eel.path.EelPath import com.intellij.util.concurrency.annotations.RequiresBlockingContext +import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.NonNls import java.nio.file.FileSystem import java.nio.file.FileSystems @@ -20,6 +21,7 @@ import java.nio.file.spi.FileSystemProvider /** * A service that is responsible for mapping between instances of [EelPath] and [Path] */ +@ApiStatus.Internal interface EelNioBridgeService { companion object { @@ -73,6 +75,7 @@ interface EelNioBridgeService { * @throws IllegalArgumentException if the Eel API for [this] does not have a corresponding [java.nio.file.FileSystem] */ @Throws(IllegalArgumentException::class) +@ApiStatus.Internal fun EelPath.asNioPath(): Path = asNioPath(null) @@ -82,6 +85,7 @@ fun EelPath.asNioPath(): Path = * This function helps to choose the proper root according to the base path of the project. */ @Throws(IllegalArgumentException::class) +@ApiStatus.Internal fun EelPath.asNioPath(project: Project?): Path { return asNioPathOrNull(project) ?: throw IllegalArgumentException("Could not convert $this to nio.Path: the corresponding provider for $descriptor is not registered in ${EelNioBridgeService::class.simpleName}") @@ -92,9 +96,11 @@ fun EelPath.asNioPath(project: Project?): Path { * but they have different string representation, and some functionality is confused when `wsl.localhost` and `wsl$` are confused. * This function helps to choose the proper root according to the base path of the project. */ +@ApiStatus.Internal fun EelPath.asNioPathOrNull(): Path? = asNioPathOrNull(null) +@ApiStatus.Internal fun EelPath.asNioPathOrNull(project: Project?): Path? { if (descriptor === LocalEelDescriptor) { return Path.of(toString()) @@ -158,6 +164,7 @@ private fun asNioPathOrNullImpl(basePath: Path?, eelRoots: Collection, sou * It can happen if [this] belongs to a [java.nio.file.FileSystem] that was not registered as a backend of `MultiRoutingFileSystemProvider` */ @Throws(IllegalArgumentException::class) +@ApiStatus.Internal fun Path.asEelPath(): EelPath { if (fileSystem != FileSystems.getDefault()) { throw IllegalArgumentException("Could not convert $this to EelPath: the path does not belong to the default NIO FileSystem") @@ -174,6 +181,7 @@ fun Path.asEelPath(): EelPath { } } +@ApiStatus.Internal fun EelDescriptor.routingPrefixes(): Set { return EelNioBridgeService.getInstanceSync().tryGetNioRoots(this) ?: throw IllegalArgumentException("Failure of obtaining prefix: could not convert $this to EelPath. The path does not belong to the default NIO FileSystem") diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt index 3c241a74dd4c..ad400790816b 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/EelProvider.kt @@ -20,9 +20,12 @@ import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.NonNls import java.nio.file.Path +@ApiStatus.Internal interface LocalWindowsEelApi : LocalEelApi, EelWindowsApi +@ApiStatus.Internal interface LocalPosixEelApi : LocalEelApi, EelPosixApi +@ApiStatus.Internal object EelInitialization { private val logger = logger() @@ -53,6 +56,7 @@ object EelInitialization { } } +@ApiStatus.Internal fun Path.getEelDescriptor(): EelDescriptor { return EelNioBridgeService.getInstanceSync().tryGetEelDescriptor(this) ?: LocalEelDescriptor } @@ -61,6 +65,7 @@ fun Path.getEelDescriptor(): EelDescriptor { * Retrieves [EelDescriptor] for the environment where [this] is located. * If the project is not the real one (i.e., it is default or not backed by a real file), then [LocalEelDescriptor] will be returned. */ +@ApiStatus.Internal fun Project.getEelDescriptor(): EelDescriptor { val filePath = projectFilePath if (filePath == null) { @@ -75,18 +80,22 @@ fun Project.getEelDescriptor(): EelDescriptor { return Path.of(filePath).getEelDescriptor() } +@get:ApiStatus.Internal val localEel: LocalEelApi by lazy { if (SystemInfo.isWindows) ApplicationManager.getApplication().service() else ApplicationManager.getApplication().service() } @Deprecated("Use toEelApiBlocking() instead", ReplaceWith("toEelApiBlocking()")) +@ApiStatus.Internal fun EelDescriptor.upgradeBlocking(): EelApi = toEelApiBlocking() +@ApiStatus.Internal fun EelDescriptor.toEelApiBlocking(): EelApi { if (this === LocalEelDescriptor) return localEel return runBlockingMaybeCancellable { toEelApi() } } +@ApiStatus.Internal data object LocalEelDescriptor : EelDescriptor { private val LOG = logger() override val userReadableDescription: @NonNls String = "Local: ${System.getProperty("os.name")}" @@ -127,6 +136,7 @@ interface EelProvider { suspend fun tryInitialize(path: String) } +@ApiStatus.Internal fun EelApi.systemOs(): OS { return when (platform) { is EelPlatform.Linux -> OS.Linux diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/package-info.java b/platform/eel-provider/src/com/intellij/platform/eel/provider/package-info.java deleted file mode 100644 index 95be88dc28b0..000000000000 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -/** - * EEL API provider - */ -@ApiStatus.Internal -package com.intellij.platform.eel.provider; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/JEelUtils.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/JEelUtils.kt index 3f95d5682ebf..3dc10119e6a0 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/JEelUtils.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/JEelUtils.kt @@ -7,11 +7,13 @@ import com.intellij.platform.eel.provider.EelNioBridgeService import com.intellij.platform.eel.provider.asEelPath import com.intellij.platform.eel.provider.asNioPath import com.intellij.platform.eel.provider.upgradeBlocking +import org.jetbrains.annotations.ApiStatus import java.nio.file.Path /** * A collection of utility methods for Java. */ +@ApiStatus.Internal object JEelUtils { @JvmStatic diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelTextUtils.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelTextUtils.kt index 898f1e390b1c..4f404a822f85 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelTextUtils.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelTextUtils.kt @@ -1,13 +1,13 @@ // 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.platform.eel.provider.utils -import com.intellij.platform.eel.ReadResult.* +import com.intellij.platform.eel.ReadResult.EOF import com.intellij.platform.eel.channels.EelReceiveChannel import com.intellij.platform.eel.channels.EelSendChannel import com.intellij.platform.eel.channels.sendWholeBuffer import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import org.jetbrains.annotations.CheckReturnValue +import org.jetbrains.annotations.ApiStatus import java.io.ByteArrayOutputStream import java.nio.ByteBuffer import java.nio.charset.Charset @@ -19,11 +19,13 @@ private val DEFAULT_CHARSET = Charsets.UTF_8 /** * Send [text] till the end. Useful to send commands to process */ +@ApiStatus.Internal suspend fun EelSendChannel.sendWholeText(text: String, charset: Charset = DEFAULT_CHARSET): Unit = sendWholeBuffer(ByteBuffer.wrap(text.toByteArray(charset))) /** * Reads text from the channel to the end. */ +@ApiStatus.Internal suspend fun EelReceiveChannel.readWholeText(bufferSize: Int = DEFAULT_BUFFER_SIZE, charset: Charset = DEFAULT_CHARSET): String = withContext(Dispatchers.IO) { val buffer = ByteBuffer.allocate(bufferSize) val result = ByteArrayOutputStream() diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelUtils.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelUtils.kt index 4d9abfbb7ee3..6de9ffb06fe6 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelUtils.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelChannelUtils.kt @@ -13,6 +13,7 @@ import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.withContext +import org.jetbrains.annotations.ApiStatus import java.io.IOException import java.io.InputStream import java.io.OutputStream @@ -36,15 +37,21 @@ import kotlin.time.Duration.Companion.milliseconds // copy functions copy data from/to an eel channel +@ApiStatus.Internal fun ReadableByteChannel.consumeAsEelChannel(): EelReceiveChannel = NioReadToEelAdapter(this) +@ApiStatus.Internal fun WritableByteChannel.asEelChannel(): EelSendChannel = NioWriteToEelAdapter(this) // Flushes data after each writing. +@ApiStatus.Internal fun OutputStream.asEelChannel(): EelSendChannel = NioWriteToEelAdapter(Channels.newChannel(this), this) +@ApiStatus.Internal fun InputStream.consumeAsEelChannel(): EelReceiveChannel = NioReadToEelAdapter(Channels.newChannel(this)) +@ApiStatus.Internal fun EelReceiveChannel.consumeAsInputStream(blockingContext: CoroutineContext = Dispatchers.IO): InputStream = InputStreamAdapterImpl(this, blockingContext) +@ApiStatus.Internal fun EelSendChannel.asOutputStream(blockingContext: CoroutineContext = Dispatchers.IO): OutputStream = OutputStreamAdapterImpl(this, blockingContext) @@ -53,6 +60,7 @@ fun EelSendChannel.asOutputStream(blockingContext: CoroutineContext = Dispatcher * Each buffer is fresh (not reused) but not flipped. * Errors are thrown out of the channel (directly or wrapped with [IOException] if not throwable). */ +@ApiStatus.Internal fun CoroutineScope.consumeReceiveChannelAsKotlin(receiveChannel: EelReceiveChannel, bufferSize: Int = DEFAULT_BUFFER_SIZE): ReceiveChannel = consumeReceiveChannelAsKotlinImpl(receiveChannel, bufferSize) @@ -76,10 +84,14 @@ fun CoroutineScope.consumeReceiveChannelAsKotlin(receiveChannel: EelReceiveChann * } * ``` */ +@ApiStatus.Internal fun EelReceiveChannel.lines(charset: Charset): Flow = linesImpl(charset) +@ApiStatus.Internal fun EelReceiveChannel.lines(): Flow = lines(Charset.defaultCharset()) +@ApiStatus.Internal fun Socket.consumeAsEelChannel(): EelReceiveChannel = consumeAsEelChannelImpl() +@ApiStatus.Internal fun Socket.asEelChannel(): EelSendChannel = asEelChannelImpl() /** @@ -88,12 +100,14 @@ fun Socket.asEelChannel(): EelSendChannel = asEelChannelImpl() * Closing [source] makes [sink] return and [IOException] * Calling [closePipe] closes both [sink] and [source], you might provide custom error that will be reported on a writing attempt. */ +@ApiStatus.Internal interface EelPipe { val sink: EelSendChannel val source: EelReceiveChannel fun closePipe(error: Throwable? = null) } +@ApiStatus.Internal fun EelPipe(): EelPipe = EelPipeImpl() @@ -101,6 +115,7 @@ fun EelPipe(): EelPipe = EelPipeImpl() * Reads all data till the end from a channel. * Semantics is the same as [InputStream.readAllBytes] */ +@ApiStatus.Internal suspend fun EelReceiveChannel.readAllBytes(): ByteArray = withContext(Dispatchers.IO) { // The current implementation is suboptimal and might be rewritten, but the API should be the same consumeAsInputStream().readAllBytes() @@ -109,12 +124,14 @@ suspend fun EelReceiveChannel.readAllBytes(): ByteArray = withContext(Dispatcher /** * Result of [copy] */ +@ApiStatus.Internal sealed class CopyError(override val cause: Throwable) : IOException() { class InError(override val cause: Throwable) : CopyError(cause) class OutError(override val cause: Throwable) : CopyError(cause) } +@ApiStatus.Internal enum class OnError { /** * Pretend to error happened, and try again after some time (simple backoff algorithm is used) @@ -134,6 +151,7 @@ enum class OnError { * [onWriteError] and [onReadError] might be used to configure read/write error processing */ @Throws(CopyError::class) +@ApiStatus.Internal suspend fun copy( src: EelReceiveChannel, dst: EelSendChannel, diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelProcessUtils.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelProcessUtils.kt index 89c26ba6f1be..bb4e4676f5b0 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelProcessUtils.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelProcessUtils.kt @@ -9,20 +9,25 @@ import com.intellij.util.io.computeDetached import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch +import org.jetbrains.annotations.ApiStatus import java.io.ByteArrayOutputStream /** * To simplify [EelProcessExecutionResult] delegation */ +@ApiStatus.Internal interface EelProcessExecutionResultInfo { val exitCode: Int val stdout: ByteArray val stderr: ByteArray } +@get:ApiStatus.Internal val EelProcessExecutionResultInfo.stdoutString: String get() = String(stdout) +@get:ApiStatus.Internal val EelProcessExecutionResultInfo.stderrString: String get() = String(stderr) +@ApiStatus.Internal class EelProcessExecutionResult(override val exitCode: Int, override val stdout: ByteArray, override val stderr: ByteArray) : EelProcessExecutionResultInfo /** @@ -41,6 +46,7 @@ class EelProcessExecutionResult(override val exitCode: Int, override val stdout: * @see EelProcess */ @OptIn(DelicateCoroutinesApi::class) +@ApiStatus.Internal suspend fun EelProcess.awaitProcessResult(): EelProcessExecutionResult { return computeDetached { ByteArrayOutputStream().use { out -> diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelTunnelUtils.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelTunnelUtils.kt index a37b8ce9ea5a..138134a55da3 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelTunnelUtils.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelTunnelUtils.kt @@ -12,6 +12,7 @@ import com.intellij.platform.eel.channels.EelSendChannel import com.intellij.util.io.blockingDispatcher import com.intellij.util.io.toByteArray import kotlinx.coroutines.* +import org.jetbrains.annotations.ApiStatus import java.io.IOException import java.net.* import java.nio.ByteBuffer @@ -33,6 +34,7 @@ private val LOG: Logger = Logger.getInstance(EelTunnelsApi::class.java) * This function returns when the server starts accepting connections. */ @OptIn(DelicateCoroutinesApi::class) +@ApiStatus.Internal fun CoroutineScope.forwardLocalPort(tunnels: EelTunnelsApi, localPort: Int, address: EelTunnelsApi.HostAddress) { val serverSocket = ServerSocket() serverSocket.bind(InetSocketAddress("localhost", localPort), 1024) @@ -93,6 +95,7 @@ fun CoroutineScope.forwardLocalPort(tunnels: EelTunnelsApi, localPort: Int, addr * @return An address which remote server listens to. It is useful to get the actual port if the port of [address] was 0 */ @OptIn(DelicateCoroutinesApi::class) +@ApiStatus.Internal fun CoroutineScope.forwardLocalServer(tunnels: EelTunnelsApi, localPort: Int, address: EelTunnelsApi.HostAddress): Deferred { // todo: do not forward anything if it is local eel val remoteAddress = CompletableDeferred() @@ -183,6 +186,7 @@ private fun CoroutineScope.redirectIJentDataToClientConnection(connectionId: Int backChannel.close() } +@ApiStatus.Internal fun EelTunnelsApi.ResolvedSocketAddress.asInetAddress(): InetSocketAddress { val inetAddress = when (this) { is EelTunnelsApi.ResolvedSocketAddress.V4 -> InetAddress.getByAddress(ByteBuffer.allocate(4).putInt(bits.toInt()).toByteArray()) diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelUtils.kt b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelUtils.kt index 36911e294988..4a2b46f90d60 100644 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelUtils.kt +++ b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/eelUtils.kt @@ -11,13 +11,16 @@ import com.intellij.platform.eel.fs.EelFsError import com.intellij.platform.eel.fs.EelOpenedFile import com.intellij.util.system.CpuArch import com.intellij.util.text.nullize +import org.jetbrains.annotations.ApiStatus import java.io.IOException import java.nio.file.* +@ApiStatus.Internal fun EelExecApi.fetchLoginShellEnvVariablesBlocking(): Map { return runBlockingMaybeCancellable { fetchLoginShellEnvVariables() } } +@ApiStatus.Internal fun CpuArch.toEelArch(): EelPlatform.Arch = when (this) { CpuArch.X86 -> EelPlatform.Arch.X86 CpuArch.X86_64 -> EelPlatform.Arch.X86_64 @@ -27,6 +30,7 @@ fun CpuArch.toEelArch(): EelPlatform.Arch = when (this) { } @Throws(FileSystemException::class) +@ApiStatus.Internal fun EelResult.getOrThrowFileSystemException(): T = when (this) { is EelResult.Ok -> value @@ -34,6 +38,7 @@ fun EelResult.getOrThrowFileSystemException(): T = } @Throws(FileSystemException::class) +@ApiStatus.Internal suspend fun >> O.getOrThrowFileSystemException(): T = when (val v = eelIt()) { is EelResult.Ok -> v.value @@ -42,6 +47,7 @@ suspend fun >> O.getOrThrowF // TODO There's java.nio.file.FileSystemLoopException, so ELOOP should be added to all error codes for a decent support of all exceptions. @Throws(FileSystemException::class) +@ApiStatus.Internal fun EelFsError.throwFileSystemException(): Nothing { throw when (this) { is EelFsError.DoesNotExist -> NoSuchFileException(where.toString(), null, message.nullize()) diff --git a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/package-info.java b/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/package-info.java deleted file mode 100644 index efec971d158b..000000000000 --- a/platform/eel-provider/src/com/intellij/platform/eel/provider/utils/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -/** - * EEL API provider - */ -@ApiStatus.Internal -package com.intellij.platform.eel.provider.utils; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/platform/eel/codegen/BuildersGeneratorTest.kt b/platform/eel/codegen/BuildersGeneratorTest.kt index 89b9d570b19c..ba3134aaac8b 100644 --- a/platform/eel/codegen/BuildersGeneratorTest.kt +++ b/platform/eel/codegen/BuildersGeneratorTest.kt @@ -92,14 +92,24 @@ import kotlin.jvm.optionals.getOrNull import kotlin.let import kotlin.run import kotlin.sequences.associateWithTo +import kotlin.sequences.filter +import kotlin.sequences.filterIsInstance +import kotlin.sequences.flatMap +import kotlin.sequences.generateSequence import kotlin.sequences.joinToString +import kotlin.sequences.map +import kotlin.sequences.takeWhile +import kotlin.sequences.toSet import kotlin.takeIf import kotlin.text.Regex +import kotlin.text.RegexOption import kotlin.text.buildString +import kotlin.text.endsWith import kotlin.text.isBlank import kotlin.text.isNotEmpty import kotlin.text.lines import kotlin.text.lowercase +import kotlin.text.matches import kotlin.text.orEmpty import kotlin.text.prependIndent import kotlin.text.removePrefix @@ -433,7 +443,7 @@ private suspend fun fillRequests( private class BuilderRequest( val shouldCheckReturnValue: Boolean, val throwsAnnotation: String?, - val deprecatedAnnotation: String?, + val annotations: Collection, val argsInterfaceFqn: String, val clsFqn: String, val methodName: String, @@ -459,9 +469,27 @@ private fun findBuilders(psiFile: PsiFile, methods: MutableList) val methodName = fn.name ?: return val methodCls = valueParameter.containingClass()?.fqName ?: return + val annotationsToCopyRegex = Regex(""" + ( + org[.]jetbrains[.]annotations[.]ApiStatus[.](Internal|Experimental|Obsolete|ScheduledForRemoval) + | + kotlin[.]Deprecated + ) + """.trimIndent(), RegexOption.COMMENTS) + methods += BuilderRequest( shouldCheckReturnValue = fn.annotationEntries.mapNotNull { it.shortName?.asString() }.contains("CheckReturnValue"), - deprecatedAnnotation = fn.annotationEntries.find { it.shortName?.asString() == "Deprecated" }?.text?.trim(), + annotations = generateSequence(fn, PsiElement::getParent) + .takeWhile { it !is PsiFile } + .filterIsInstance() + .flatMap { it.annotationEntries } + .filter { + analyze(it) { + it.typeReference?.getFqn()?.matches(annotationsToCopyRegex) == true + } + } + .map { it.text.trim() } + .toSet(), throwsAnnotation = fn.annotationEntries.filter { it.shortName?.asString() in listOf("Throws", "ThrowsChecked") }.joinToString(" ") { it.text.trim() }, argsInterfaceFqn = typeFqn, clsFqn = methodCls.asString(), @@ -581,6 +609,7 @@ private suspend fun writeBuilderFiles( requiredArguments = requiredArguments, optionalArguments = optionalArguments, propertyNames = propertyNames, + annotations = builderRequest.annotations, ) } @@ -613,7 +642,7 @@ private suspend fun writeBuilderFiles( } text += """ - ${kdoc.renderKdoc()}@GeneratedBuilder.Result${builderRequest.deprecatedAnnotation ?: ""} + ${kdoc.renderKdoc()}@GeneratedBuilder.Result${builderRequest.annotations.joinToString("\n")} fun ${builderRequest.clsFqn}.${builderRequest.methodName}(${ requiredArguments.joinToString("") { prop -> "\n${prop.name}: ${prop.typeFqn}," @@ -625,7 +654,9 @@ private suspend fun writeBuilderFiles( """ } - text += "object ${clsFqn.removePrefix("$sourcePackage.").split('.').first()}Helpers {" + val annotationsForGroup = annotationsForGroup(clsBuilderRequests.map { it.annotations }) + + text += "$annotationsForGroup object ${clsFqn.removePrefix("$sourcePackage.").split('.').first()}Helpers {" for (builderRequest in clsBuilderRequests) { val argsInterfaceInfo = argsInterfacesByFqn[builderRequest.argsInterfaceFqn]!! @@ -634,7 +665,7 @@ private suspend fun writeBuilderFiles( /** * Create it via [${builderRequest.clsFqn}.${builderRequest.methodName}]. */ - @GeneratedBuilder.Result + @GeneratedBuilder.Result${builderRequest.annotations.joinToString("\n")} class ${builderRequest.methodName.replaceFirstChar(Char::uppercaseChar)}( private val owner: ${builderRequest.clsFqn}, ${ argsInterfaceInfo.requiredArguments.joinToString("") { prop -> @@ -680,7 +711,7 @@ private suspend fun writeBuilderFiles( for ((argsInterfaceFqn, argsInterfaceInfo) in argsInterfacesByFqn) { text = """ @GeneratedBuilder.Result - class ${argsInterfaceInfo.name}Builder${ + ${argsInterfaceInfo.annotations.sorted().joinToString("\n")} class ${argsInterfaceInfo.name}Builder${ argsInterfaceInfo.requiredArguments.joinToString("", "(", ")") { prop -> "\n${prop.kdoc.renderKdoc()}private var ${prop.name}: ${prop.typeFqn}," } @@ -733,6 +764,21 @@ private suspend fun writeBuilderFiles( return filesContent } +private fun annotationsForGroup(annotationGroups: List>): String { + val union = annotationGroups.flatten().toSet() + val result = annotationGroups + .reduce { a, b -> a intersect b } + .toMutableSet() + union.find { it.endsWith(".Experimental") }?.let { experimental -> + result += experimental + } + union.find { it.endsWith(".Internal") }?.let { internal -> + result.removeIf { experimental -> experimental.endsWith(".Experimental") } + result += internal + } + return result.sorted().joinToString() +} + private fun renderPropertyInBuilder( tempProject: Project, name: String, @@ -847,4 +893,5 @@ private class ArgInterfaceInfo( val requiredArguments: List, val optionalArguments: List, val propertyNames: List, + val annotations: Collection, ) \ No newline at end of file diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/EelExecApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/EelExecApiHelpers.kt index c987d1843f56..1098bde908df 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/EelExecApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/EelExecApiHelpers.kt @@ -9,6 +9,7 @@ import com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions import com.intellij.platform.eel.EelExecApi.InteractionOptions import com.intellij.platform.eel.EelExecApi.PtyOrStdErrSettings import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.CheckReturnValue @@ -29,6 +30,7 @@ import org.jetbrains.annotations.CheckReturnValue */ @GeneratedBuilder.Result @Deprecated("Use spawnProcess instead") +@ApiStatus.Internal fun EelExecApi.execute( exe: String, ): EelExecApiHelpers.Execute = @@ -45,6 +47,7 @@ fun EelExecApi.execute( * [ExecuteProcessOptions.workingDirectory] is the path on the Linux host. There's no automatic path mapping in this interface. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelExecApi.spawnProcess( exe: String, ): EelExecApiHelpers.SpawnProcess = @@ -53,11 +56,14 @@ fun EelExecApi.spawnProcess( exe = exe, ) +@ApiStatus.Internal object EelExecApiHelpers { /** * Create it via [com.intellij.platform.eel.EelExecApi.execute]. */ @GeneratedBuilder.Result + @Deprecated("Use spawnProcess instead") + @ApiStatus.Internal class Execute( private val owner: EelExecApi, private var exe: String, @@ -145,6 +151,7 @@ object EelExecApiHelpers { * Create it via [com.intellij.platform.eel.EelExecApi.spawnProcess]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class SpawnProcess( private val owner: EelExecApi, private var exe: String, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/EelExecPosixApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/EelExecPosixApiHelpers.kt index 731db3d5f5de..c042956454a5 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/EelExecPosixApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/EelExecPosixApiHelpers.kt @@ -9,6 +9,7 @@ import com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions import com.intellij.platform.eel.EelExecApi.InteractionOptions import com.intellij.platform.eel.EelExecApi.PtyOrStdErrSettings import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus /** @@ -19,6 +20,7 @@ import com.intellij.platform.eel.path.EelPath * [ExecuteProcessOptions.workingDirectory] is the path on the Linux host. There's no automatic path mapping in this interface. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelExecPosixApi.spawnProcess( exe: String, ): EelExecPosixApiHelpers.SpawnProcess = @@ -27,11 +29,13 @@ fun EelExecPosixApi.spawnProcess( exe = exe, ) +@ApiStatus.Internal object EelExecPosixApiHelpers { /** * Create it via [com.intellij.platform.eel.EelExecPosixApi.spawnProcess]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class SpawnProcess( private val owner: EelExecPosixApi, private var exe: String, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/EelExecWindowsApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/EelExecWindowsApiHelpers.kt index efef976df8fd..53482b98c4bd 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/EelExecWindowsApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/EelExecWindowsApiHelpers.kt @@ -9,6 +9,7 @@ import com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions import com.intellij.platform.eel.EelExecApi.InteractionOptions import com.intellij.platform.eel.EelExecApi.PtyOrStdErrSettings import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus /** @@ -19,6 +20,7 @@ import com.intellij.platform.eel.path.EelPath * [ExecuteProcessOptions.workingDirectory] is the path on the Linux host. There's no automatic path mapping in this interface. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelExecWindowsApi.spawnProcess( exe: String, ): EelExecWindowsApiHelpers.SpawnProcess = @@ -27,11 +29,13 @@ fun EelExecWindowsApi.spawnProcess( exe = exe, ) +@ApiStatus.Internal object EelExecWindowsApiHelpers { /** * Create it via [com.intellij.platform.eel.EelExecWindowsApi.spawnProcess]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class SpawnProcess( private val owner: EelExecWindowsApi, private var exe: String, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/EelTunnelsApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/EelTunnelsApiHelpers.kt index 6b174d0b06a0..d00bd548616a 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/EelTunnelsApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/EelTunnelsApiHelpers.kt @@ -7,6 +7,7 @@ package com.intellij.platform.eel import com.intellij.platform.eel.* import com.intellij.platform.eel.EelTunnelsApi.Connection import kotlinx.coroutines.channels.SendChannel +import org.jetbrains.annotations.ApiStatus import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @@ -34,6 +35,7 @@ import kotlin.time.Duration.Companion.seconds * One should not forget to invoke [Connection.close] when the connection is not needed. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelTunnelsApi.getAcceptorForRemotePort(): EelTunnelsApiHelpers.GetAcceptorForRemotePort = EelTunnelsApiHelpers.GetAcceptorForRemotePort( owner = this, @@ -65,16 +67,19 @@ fun EelTunnelsApi.getAcceptorForRemotePort(): EelTunnelsApiHelpers.GetAcceptorFo * To configure a socket before connection use [configureSocketBeforeConnection]. After that, use [Connection.configureSocket] */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelTunnelsApi.getConnectionToRemotePort(): EelTunnelsApiHelpers.GetConnectionToRemotePort = EelTunnelsApiHelpers.GetConnectionToRemotePort( owner = this, ) +@ApiStatus.Internal object EelTunnelsApiHelpers { /** * Create it via [com.intellij.platform.eel.EelTunnelsApi.getAcceptorForRemotePort]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class GetAcceptorForRemotePort( private val owner: EelTunnelsApi, ) : OwnedBuilder { @@ -145,6 +150,7 @@ object EelTunnelsApiHelpers { * Create it via [com.intellij.platform.eel.EelTunnelsApi.getConnectionToRemotePort]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class GetConnectionToRemotePort( private val owner: EelTunnelsApi, ) : OwnedBuilder { diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/ExecuteProcessOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/ExecuteProcessOptionsBuilder.kt index 7b1075bf06cc..d6dc194749fe 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/ExecuteProcessOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/ExecuteProcessOptionsBuilder.kt @@ -8,9 +8,11 @@ import com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions import com.intellij.platform.eel.EelExecApi.InteractionOptions import com.intellij.platform.eel.EelExecApi.PtyOrStdErrSettings import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class ExecuteProcessOptionsBuilder( /** * An **absolute** path to the executable. diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/GetAcceptorForRemotePortBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/GetAcceptorForRemotePortBuilder.kt index 31bc925134c9..b869feb91de6 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/GetAcceptorForRemotePortBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/GetAcceptorForRemotePortBuilder.kt @@ -5,11 +5,13 @@ package com.intellij.platform.eel import com.intellij.platform.eel.EelTunnelsApi.GetAcceptorForRemotePort +import org.jetbrains.annotations.ApiStatus import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @GeneratedBuilder.Result +@ApiStatus.Internal class GetAcceptorForRemotePortBuilder() { private var configureServerSocket: @ExtensionFunctionType Function1 = {} diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/GetConnectionToRemotePortArgsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/GetConnectionToRemotePortArgsBuilder.kt index 15db5187afa3..c8e349331452 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/GetConnectionToRemotePortArgsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/GetConnectionToRemotePortArgsBuilder.kt @@ -5,11 +5,13 @@ package com.intellij.platform.eel import com.intellij.platform.eel.EelTunnelsApi.GetConnectionToRemotePortArgs +import org.jetbrains.annotations.ApiStatus import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @GeneratedBuilder.Result +@ApiStatus.Internal class GetConnectionToRemotePortArgsBuilder() { private var configureSocketBeforeConnection: @ExtensionFunctionType Function1 = {} diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/ChangeAttributesOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/ChangeAttributesOptionsBuilder.kt index 0660e03b490a..739d661eb472 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/ChangeAttributesOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/ChangeAttributesOptionsBuilder.kt @@ -9,9 +9,11 @@ import com.intellij.platform.eel.fs.EelFileInfo.Permissions import com.intellij.platform.eel.fs.EelFileSystemApi.ChangeAttributesOptions import com.intellij.platform.eel.fs.EelFileSystemApi.TimeSinceEpoch import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class ChangeAttributesOptionsBuilder( private var path: EelPath, ) { diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/CopyOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/CopyOptionsBuilder.kt index 94888db1bbd9..60ae8e9b4d05 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/CopyOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/CopyOptionsBuilder.kt @@ -7,9 +7,11 @@ package com.intellij.platform.eel.fs import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.CopyOptions import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class CopyOptionsBuilder( private var source: EelPath, private var target: EelPath, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/CreateTemporaryEntryOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/CreateTemporaryEntryOptionsBuilder.kt index de3022ef9780..b74de43ec357 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/CreateTemporaryEntryOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/CreateTemporaryEntryOptionsBuilder.kt @@ -7,9 +7,11 @@ package com.intellij.platform.eel.fs import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.CreateTemporaryEntryOptions import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class CreateTemporaryEntryOptionsBuilder() { private var deleteOnExit: Boolean = false diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemApiHelpers.kt index dfc457f1bc29..6e0820bd0382 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemApiHelpers.kt @@ -19,10 +19,12 @@ import com.intellij.platform.eel.fs.EelFileSystemApi.WatchOptions import com.intellij.platform.eel.fs.EelFileSystemApi.WatchedPath import com.intellij.platform.eel.path.EelPath import kotlinx.coroutines.flow.Flow +import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.CheckReturnValue @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.changeAttributes( path: EelPath, ): EelFileSystemApiHelpers.ChangeAttributes = @@ -32,6 +34,7 @@ fun EelFileSystemApi.changeAttributes( ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.copy( source: EelPath, target: EelPath, @@ -43,12 +46,14 @@ fun EelFileSystemApi.copy( ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.createTemporaryDirectory(): EelFileSystemApiHelpers.CreateTemporaryDirectory = EelFileSystemApiHelpers.CreateTemporaryDirectory( owner = this, ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.createTemporaryFile(): EelFileSystemApiHelpers.CreateTemporaryFile = EelFileSystemApiHelpers.CreateTemporaryFile( owner = this, @@ -63,6 +68,7 @@ fun EelFileSystemApi.createTemporaryFile(): EelFileSystemApiHelpers.CreateTempor * TODO The behaviour is different from resolveSymlinks in [stat]. To be fixed. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.listDirectoryWithAttrs( path: EelPath, ): EelFileSystemApiHelpers.ListDirectoryWithAttrs = @@ -72,6 +78,7 @@ fun EelFileSystemApi.listDirectoryWithAttrs( ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.move( source: EelPath, target: EelPath, @@ -86,6 +93,7 @@ fun EelFileSystemApi.move( * Similar to stat(2) and lstat(2). [symlinkPolicy] has an impact only on [EelFileInfo.type] if [path] points on a symlink. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.stat( path: EelPath, ): EelFileSystemApiHelpers.Stat = @@ -103,6 +111,7 @@ fun EelFileSystemApi.stat( * @throws UnsupportedOperationException if the method isn't implemented for the file system. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.unwatch( path: EelPath, ): EelFileSystemApiHelpers.Unwatch = @@ -130,12 +139,14 @@ fun EelFileSystemApi.unwatch( * @throws UnsupportedOperationException if the method isn't implemented for the file system. */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.watchChanges(): EelFileSystemApiHelpers.WatchChanges = EelFileSystemApiHelpers.WatchChanges( owner = this, ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.openForReadingAndWriting( path: EelPath, ): EelFileSystemApiHelpers.OpenForReadingAndWriting = @@ -148,6 +159,7 @@ fun EelFileSystemApi.openForReadingAndWriting( * Opens the file only for writing */ @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemApi.openForWriting( path: EelPath, ): EelFileSystemApiHelpers.OpenForWriting = @@ -156,11 +168,13 @@ fun EelFileSystemApi.openForWriting( path = path, ) +@ApiStatus.Internal object EelFileSystemApiHelpers { /** * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.changeAttributes]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class ChangeAttributes( private val owner: EelFileSystemApi, private var path: EelPath, @@ -207,6 +221,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.copy]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class Copy( private val owner: EelFileSystemApi, private var source: EelPath, @@ -273,6 +288,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.createTemporaryDirectory]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class CreateTemporaryDirectory( private val owner: EelFileSystemApi, ) : OwnedBuilder> { @@ -320,6 +336,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.createTemporaryFile]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class CreateTemporaryFile( private val owner: EelFileSystemApi, ) : OwnedBuilder> { @@ -367,6 +384,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.listDirectoryWithAttrs]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class ListDirectoryWithAttrs( private val owner: EelFileSystemApi, private var path: EelPath, @@ -408,6 +426,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.move]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class Move( private val owner: EelFileSystemApi, private var source: EelPath, @@ -462,6 +481,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.stat]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class Stat( private val owner: EelFileSystemApi, private var path: EelPath, @@ -503,6 +523,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.unwatch]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class Unwatch( private val owner: EelFileSystemApi, private var path: EelPath, @@ -530,6 +551,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.watchChanges]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class WatchChanges( private val owner: EelFileSystemApi, ) : OwnedBuilder> { @@ -563,6 +585,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.openForReadingAndWriting]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class OpenForReadingAndWriting( private val owner: EelFileSystemApi, private var path: EelPath, @@ -618,6 +641,7 @@ object EelFileSystemApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemApi.openForWriting]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class OpenForWriting( private val owner: EelFileSystemApi, private var path: EelPath, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemPosixApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemPosixApiHelpers.kt index 7e7671d0222b..8b8cdb1451f1 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemPosixApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemPosixApiHelpers.kt @@ -10,10 +10,12 @@ import com.intellij.platform.eel.OwnedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.StatError import com.intellij.platform.eel.fs.EelFileSystemApi.SymlinkPolicy import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.CheckReturnValue @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemPosixApi.listDirectoryWithAttrs( path: EelPath, ): EelFileSystemPosixApiHelpers.ListDirectoryWithAttrs = @@ -23,6 +25,7 @@ fun EelFileSystemPosixApi.listDirectoryWithAttrs( ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemPosixApi.stat( path: EelPath, ): EelFileSystemPosixApiHelpers.Stat = @@ -31,11 +34,13 @@ fun EelFileSystemPosixApi.stat( path = path, ) +@ApiStatus.Internal object EelFileSystemPosixApiHelpers { /** * Create it via [com.intellij.platform.eel.fs.EelFileSystemPosixApi.listDirectoryWithAttrs]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class ListDirectoryWithAttrs( private val owner: EelFileSystemPosixApi, private var path: EelPath, @@ -77,6 +82,7 @@ object EelFileSystemPosixApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemPosixApi.stat]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class Stat( private val owner: EelFileSystemPosixApi, private var path: EelPath, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemWindowsApiHelpers.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemWindowsApiHelpers.kt index 5baf039bff3c..f8cc329ddef2 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemWindowsApiHelpers.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/EelFileSystemWindowsApiHelpers.kt @@ -10,10 +10,12 @@ import com.intellij.platform.eel.OwnedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.StatError import com.intellij.platform.eel.fs.EelFileSystemApi.SymlinkPolicy import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.CheckReturnValue @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemWindowsApi.listDirectoryWithAttrs( path: EelPath, ): EelFileSystemWindowsApiHelpers.ListDirectoryWithAttrs = @@ -23,6 +25,7 @@ fun EelFileSystemWindowsApi.listDirectoryWithAttrs( ) @GeneratedBuilder.Result +@ApiStatus.Internal fun EelFileSystemWindowsApi.stat( path: EelPath, ): EelFileSystemWindowsApiHelpers.Stat = @@ -31,11 +34,13 @@ fun EelFileSystemWindowsApi.stat( path = path, ) +@ApiStatus.Internal object EelFileSystemWindowsApiHelpers { /** * Create it via [com.intellij.platform.eel.fs.EelFileSystemWindowsApi.listDirectoryWithAttrs]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class ListDirectoryWithAttrs( private val owner: EelFileSystemWindowsApi, private var path: EelPath, @@ -77,6 +82,7 @@ object EelFileSystemWindowsApiHelpers { * Create it via [com.intellij.platform.eel.fs.EelFileSystemWindowsApi.stat]. */ @GeneratedBuilder.Result + @ApiStatus.Internal class Stat( private val owner: EelFileSystemWindowsApi, private var path: EelPath, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/ListDirectoryWithAttrsArgsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/ListDirectoryWithAttrsArgsBuilder.kt index 8e3dc2372383..d99f6322054c 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/ListDirectoryWithAttrsArgsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/ListDirectoryWithAttrsArgsBuilder.kt @@ -8,9 +8,11 @@ import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.ListDirectoryWithAttrsArgs import com.intellij.platform.eel.fs.EelFileSystemApi.SymlinkPolicy import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class ListDirectoryWithAttrsArgsBuilder( private var path: EelPath, ) { diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/MoveArgsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/MoveArgsBuilder.kt index 4ae12919ea7e..f77a2ef55913 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/MoveArgsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/MoveArgsBuilder.kt @@ -8,9 +8,11 @@ import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.MoveArgs import com.intellij.platform.eel.fs.EelFileSystemApi.ReplaceExistingDuringMove import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class MoveArgsBuilder( private var source: EelPath, private var target: EelPath, diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/StatArgsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/StatArgsBuilder.kt index f6c57fc7d5fa..2ffaa1197d79 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/StatArgsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/StatArgsBuilder.kt @@ -8,9 +8,11 @@ import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.StatArgs import com.intellij.platform.eel.fs.EelFileSystemApi.SymlinkPolicy import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class StatArgsBuilder( private var path: EelPath, ) { diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/UnwatchOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/UnwatchOptionsBuilder.kt index 9e637cc0748b..2cf9f5d3a679 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/UnwatchOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/UnwatchOptionsBuilder.kt @@ -7,9 +7,11 @@ package com.intellij.platform.eel.fs import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.UnwatchOptions import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class UnwatchOptionsBuilder( private var path: EelPath, ) { diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/WatchOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/WatchOptionsBuilder.kt index 049dfeb8572a..7eb3fe7b0d74 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/WatchOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/WatchOptionsBuilder.kt @@ -8,9 +8,11 @@ import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.FileChangeType import com.intellij.platform.eel.fs.EelFileSystemApi.WatchOptions import com.intellij.platform.eel.fs.EelFileSystemApi.WatchedPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class WatchOptionsBuilder() { private var changeTypes: Set = emptySet() diff --git a/platform/eel/gen-builders/com/intellij/platform/eel/fs/WriteOptionsBuilder.kt b/platform/eel/gen-builders/com/intellij/platform/eel/fs/WriteOptionsBuilder.kt index 3fbd147e8828..c3c084c626e6 100644 --- a/platform/eel/gen-builders/com/intellij/platform/eel/fs/WriteOptionsBuilder.kt +++ b/platform/eel/gen-builders/com/intellij/platform/eel/fs/WriteOptionsBuilder.kt @@ -8,9 +8,11 @@ import com.intellij.platform.eel.GeneratedBuilder import com.intellij.platform.eel.fs.EelFileSystemApi.FileWriterCreationMode import com.intellij.platform.eel.fs.EelFileSystemApi.WriteOptions import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus @GeneratedBuilder.Result +@ApiStatus.Internal class WriteOptionsBuilder( private var path: EelPath, ) { diff --git a/platform/eel/src/com/intellij/platform/eel/EelApi.kt b/platform/eel/src/com/intellij/platform/eel/EelApi.kt index 0fb75841a9da..a2463bba7e5e 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelApi.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelApi.kt @@ -4,13 +4,16 @@ package com.intellij.platform.eel import com.intellij.platform.eel.fs.EelFileSystemApi import com.intellij.platform.eel.fs.EelFileSystemPosixApi import com.intellij.platform.eel.fs.EelFileSystemWindowsApi +import org.jetbrains.annotations.ApiStatus /** * Marker interface that indicates EelApi is running on a local machine. * The check for “is local” should be performed only in very specific cases */ +@ApiStatus.Internal interface LocalEelApi : EelApi +@ApiStatus.Internal interface EelApi { val descriptor: EelDescriptor @@ -42,6 +45,7 @@ interface EelApi { } } +@ApiStatus.Internal interface EelPosixApi : EelApi { override val exec: EelExecPosixApi override val platform: EelPlatform.Posix get() = descriptor.platform as EelPlatform.Posix @@ -50,6 +54,7 @@ interface EelPosixApi : EelApi { override val fs: EelFileSystemPosixApi } +@ApiStatus.Internal interface EelWindowsApi : EelApi { override val exec: EelExecWindowsApi override val platform: EelPlatform.Windows get() = descriptor.platform as EelPlatform.Windows diff --git a/platform/eel/src/com/intellij/platform/eel/EelArchiveApi.kt b/platform/eel/src/com/intellij/platform/eel/EelArchiveApi.kt index 6a46eb20ddde..e8d955476129 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelArchiveApi.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelArchiveApi.kt @@ -2,7 +2,9 @@ package com.intellij.platform.eel import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus +@ApiStatus.Internal interface EelArchiveApi { suspend fun extract(archive: EelPath, target: EelPath) } diff --git a/platform/eel/src/com/intellij/platform/eel/EelDescriptor.kt b/platform/eel/src/com/intellij/platform/eel/EelDescriptor.kt index 623b727ff2f9..6b59dfa9b850 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelDescriptor.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelDescriptor.kt @@ -17,6 +17,7 @@ import org.jetbrains.annotations.NonNls * @see com.intellij.openapi.fileChooser.impl.LocalFileChooserFactory.canUseNativeDialog */ @ApiStatus.OverrideOnly +@ApiStatus.Internal interface EelDescriptorWithoutNativeFileChooserSupport : EelDescriptor /** @@ -48,6 +49,7 @@ interface EelDescriptorWithoutNativeFileChooserSupport : EelDescriptor * TODO: In the future, [EelDescriptor] may also be serializable. * If you need to access the remote environment, you can use the method [toEelApi], which can suspend for some time before returning a working instance of [EelApi] */ +@ApiStatus.Internal interface EelDescriptor { @Deprecated("Use platform instead", ReplaceWith("platform")) val operatingSystem: OS diff --git a/platform/eel/src/com/intellij/platform/eel/EelException.kt b/platform/eel/src/com/intellij/platform/eel/EelException.kt index 21e09d23688f..0b29f0a206f2 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelException.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelException.kt @@ -5,6 +5,7 @@ import org.jetbrains.annotations.ApiStatus import java.io.IOException @ApiStatus.NonExtendable +@ApiStatus.Internal abstract class EelException @JvmOverloads constructor( open val error: EelError, cause: Throwable? = null, diff --git a/platform/eel/src/com/intellij/platform/eel/EelExecApi.kt b/platform/eel/src/com/intellij/platform/eel/EelExecApi.kt index da602f3108b5..4f7b69453d85 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelExecApi.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelExecApi.kt @@ -11,6 +11,7 @@ import org.jetbrains.annotations.CheckReturnValue /** * Methods related to process execution: start a process, collect stdin/stdout/stderr of the process, etc. */ +@ApiStatus.Internal sealed interface EelExecApi { val descriptor: EelDescriptor @@ -199,26 +200,32 @@ sealed interface EelExecApi { data object RedirectStdErr : InteractionOptions } +@ApiStatus.Internal interface EelExecPosixApi : EelExecApi { @ThrowsChecked(ExecuteProcessException::class) override suspend fun spawnProcess(@GeneratedBuilder generatedBuilder: ExecuteProcessOptions): EelPosixProcess } +@ApiStatus.Internal interface EelExecWindowsApi : EelExecApi { @ThrowsChecked(ExecuteProcessException::class) override suspend fun spawnProcess(@GeneratedBuilder generatedBuilder: ExecuteProcessOptions): EelWindowsProcess } +@ApiStatus.Internal suspend fun EelExecApi.where(exe: String): EelPath? { return this.findExeFilesInPath(exe).firstOrNull() } +@ApiStatus.Internal fun EelExecApi.spawnProcess(exe: String, vararg args: String): EelExecApiHelpers.SpawnProcess = spawnProcess(exe).args(*args) +@ApiStatus.Internal fun EelExecPosixApi.spawnProcess(exe: String, vararg args: String): EelExecPosixApiHelpers.SpawnProcess = spawnProcess(exe).args(*args) +@ApiStatus.Internal fun EelExecWindowsApi.spawnProcess(exe: String, vararg args: String): EelExecWindowsApiHelpers.SpawnProcess = spawnProcess(exe).args(*args) @@ -226,6 +233,7 @@ fun EelExecWindowsApi.spawnProcess(exe: String, vararg args: String): EelExecWin * Path to a shell / command processor: `cmd.exe` on Windows and Bourne Shell (`sh`) on POSIX. * Second argument is the one you might provide to this shell to execute command and exit, i.e.: `cmd /C` or `sh -c` */ +@ApiStatus.Internal suspend fun EelExecApi.getShell(): Pair { val (shell, cmdArg) = when (this.descriptor.platform) { is EelPlatform.Windows -> { diff --git a/platform/eel/src/com/intellij/platform/eel/EelIpPreference.kt b/platform/eel/src/com/intellij/platform/eel/EelIpPreference.kt index b351a9362392..bac2eb82e364 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelIpPreference.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelIpPreference.kt @@ -1,6 +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.platform.eel +import org.jetbrains.annotations.ApiStatus + +@ApiStatus.Internal enum class EelIpPreference { PREFER_V4, PREFER_V6, USE_SYSTEM_DEFAULT } \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/EelPlatform.kt b/platform/eel/src/com/intellij/platform/eel/EelPlatform.kt index 756b895cba83..7509ca6e6483 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelPlatform.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelPlatform.kt @@ -2,26 +2,37 @@ package com.intellij.platform.eel import com.intellij.platform.eel.EelPlatform.* +import org.jetbrains.annotations.ApiStatus +@get:ApiStatus.Internal val EelPlatform.isMac: Boolean get() = this is Darwin +@get:ApiStatus.Internal val EelPlatform.isLinux: Boolean get() = this is Linux +@get:ApiStatus.Internal val EelPlatform.isWindows: Boolean get() = this is Windows +@get:ApiStatus.Internal val EelPlatform.isFreeBSD: Boolean get() = this is FreeBSD +@get:ApiStatus.Internal val EelPlatform.isArm32: Boolean get() = arch is Arch.ARM_32 +@get:ApiStatus.Internal val EelPlatform.isArm64: Boolean get() = arch is Arch.ARM_64 +@get:ApiStatus.Internal val EelPlatform.isX86: Boolean get() = arch is Arch.X86 +@get:ApiStatus.Internal val EelPlatform.isX86_64: Boolean get() = arch is Arch.X86_64 private val UNIX_DIRECTORY_SEPARATORS = charArrayOf('/') private val WINDOWS_DIRECTORY_SEPARATORS = charArrayOf('/', '\\') +@get:ApiStatus.Internal val EelPlatform.directorySeparators: CharArray get() = when (this) { is Windows -> WINDOWS_DIRECTORY_SEPARATORS is Posix -> UNIX_DIRECTORY_SEPARATORS } +@ApiStatus.Internal sealed interface EelPlatform { val arch: Arch @@ -74,6 +85,7 @@ sealed interface EelPlatform { } } +@get:ApiStatus.Internal val EelPlatform.pathSeparator: String get() = when (this) { is Windows -> ";" diff --git a/platform/eel/src/com/intellij/platform/eel/EelProcess.kt b/platform/eel/src/com/intellij/platform/eel/EelProcess.kt index 38bb3cd86b87..a2fadf5f5e0a 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelProcess.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelProcess.kt @@ -4,12 +4,13 @@ package com.intellij.platform.eel import com.intellij.platform.eel.channels.EelReceiveChannel import com.intellij.platform.eel.channels.EelSendChannel import kotlinx.coroutines.Deferred -import java.io.IOException +import org.jetbrains.annotations.ApiStatus /** * Represents some process that was launched via [EelExecApi.spawnProcess]. * */ +@ApiStatus.Internal sealed interface EelProcess { val pid: EelApi.Pid @@ -57,6 +58,7 @@ sealed interface EelProcess { } } +@ApiStatus.Internal interface EelPosixProcess : EelProcess { /** * Sends `SIGTERM` on Unix. @@ -64,6 +66,7 @@ interface EelPosixProcess : EelProcess { suspend fun terminate() } +@ApiStatus.Internal interface EelWindowsProcess : EelProcess { // Nothing yet. } \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/EelResult.kt b/platform/eel/src/com/intellij/platform/eel/EelResult.kt index 95a88879083d..a22c41bd30b0 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelResult.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelResult.kt @@ -9,6 +9,7 @@ import org.jetbrains.annotations.ApiStatus * Refrain from making new extension functions for [EelResult] and for using it in state of objects, putting EelResults into collections, etc. */ @ApiStatus.Obsolete +@ApiStatus.Internal sealed interface EelResult { interface Ok : EelResult { val value: P @@ -20,6 +21,7 @@ sealed interface EelResult EelResult.getOr(action: (EelResult.Error) -> Nothing): T = when (this) { is EelResult.Ok -> this.value is EelResult.Error -> action(this) } @JvmOverloads +@ApiStatus.Internal inline fun EelResult.getOrThrow(exception: (E) -> Throwable = { if (it is Throwable) it else RuntimeException(it.toString()) }): T = getOr { throw exception(it.error) } +@ApiStatus.Internal suspend inline fun O.getOrThrow(exception: (E) -> Throwable = { if (it is Throwable) it else RuntimeException(it.toString()) }): T where R : EelResult, O : OwnedBuilder = eelIt().getOrThrow(exception) +@ApiStatus.Internal fun EelResult.getOrNull(): T? = when (this) { is EelResult.Ok -> this.value is EelResult.Error -> null diff --git a/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt b/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt index 9b6573f40041..a3ed22ae8d46 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelTunnelsApi.kt @@ -8,6 +8,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.coroutineScope +import org.jetbrains.annotations.ApiStatus import java.io.IOException import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @@ -15,6 +16,7 @@ import kotlin.time.Duration.Companion.seconds /** * API for sockets. Use [hostAddressBuilder] to create arguments. */ +@ApiStatus.Internal sealed interface EelTunnelsApi { /** * Creates a remote UNIX socket forwarding. IJent listens for a connection on the remote machine, and when the connection @@ -272,6 +274,7 @@ sealed interface EelTunnelsApi { /** * Socket configuration valid both for server and client socket */ +@ApiStatus.Internal interface ConfigurableSocket { /** * Sets the possibility to reuse address of the socket @@ -283,6 +286,7 @@ interface ConfigurableSocket { /** * Client only socket options */ +@ApiStatus.Internal interface ConfigurableClientSocket : ConfigurableSocket { /** * Disables pending data until acknowledgement @@ -295,18 +299,22 @@ interface ConfigurableClientSocket : ConfigurableSocket { * Convenience operator to decompose connection to a pair of channels when needed. * @return channel to server */ +@ApiStatus.Internal operator fun Connection.component1(): EelSendChannel = sendChannel /** * Convenience operator to decompose connection to a pair of channels when needed. * @return channel from server */ +@ApiStatus.Internal operator fun Connection.component2(): EelReceiveChannel = receiveChannel +@ApiStatus.Internal interface EelTunnelsPosixApi : EelTunnelsApi { } +@ApiStatus.Internal interface EelTunnelsWindowsApi : EelTunnelsApi /** @@ -331,6 +339,7 @@ interface EelTunnelsWindowsApi : EelTunnelsApi * * @see EelTunnelsApi.getConnectionToRemotePort for more details on the behavior of [Connection] */ +@ApiStatus.Internal suspend fun EelTunnelsApiHelpers.GetConnectionToRemotePort.withConnectionToRemotePort( errorHandler: suspend (EelConnectionError) -> T, action: suspend CoroutineScope.(Connection) -> T, @@ -369,17 +378,20 @@ private suspend fun closeWithExceptionHandling(action: suspend CoroutineScop } } +@ApiStatus.Internal fun EelTunnelsApiHelpers.GetConnectionToRemotePort.hostAddress( addr: EelTunnelsApi.HostAddress, ): EelTunnelsApiHelpers.GetConnectionToRemotePort = hostname(addr.hostname).port(addr.port).protocolPreference(addr.protocolPreference).timeout(addr.timeout) +@ApiStatus.Internal suspend fun EelTunnelsApi.withConnectionToRemotePort( host: String, port: UShort, errorHandler: suspend (EelConnectionError) -> T, action: suspend CoroutineScope.(Connection) -> T, ): T = getConnectionToRemotePort().hostname(host).port(port).withConnectionToRemotePort(errorHandler, action) +@ApiStatus.Internal suspend fun EelTunnelsApi.withConnectionToRemotePort( remotePort: UShort, errorHandler: suspend (EelConnectionError) -> T, @@ -387,6 +399,7 @@ suspend fun EelTunnelsApi.withConnectionToRemotePort( ): T = withConnectionToRemotePort("localhost", remotePort, errorHandler, action) +@ApiStatus.Internal suspend fun EelTunnelsApiHelpers.GetAcceptorForRemotePort.withAcceptorForRemotePort( errorHandler: suspend (EelConnectionError) -> T, action: suspend CoroutineScope.(EelTunnelsApi.ConnectionAcceptor) -> T, @@ -399,6 +412,7 @@ suspend fun EelTunnelsApiHelpers.GetAcceptorForRemotePort.withAcceptorForRem } } +@ApiStatus.Internal fun EelTunnelsApiHelpers.GetAcceptorForRemotePort.hostAddress( addr: EelTunnelsApi.HostAddress, ): EelTunnelsApiHelpers.GetAcceptorForRemotePort = @@ -407,11 +421,13 @@ fun EelTunnelsApiHelpers.GetAcceptorForRemotePort.hostAddress( /** * Represents a common class for all network-related errors appearing during the interaction with IJent or local process */ +@ApiStatus.Internal sealed interface EelNetworkError : EelError /** * An error that can happen during the creation of a connection to a remote server */ +@ApiStatus.Internal sealed class EelConnectionError(override val message: String) : EelNetworkError, IOException() { /** diff --git a/platform/eel/src/com/intellij/platform/eel/EelUserInfo.kt b/platform/eel/src/com/intellij/platform/eel/EelUserInfo.kt index 28e63df22059..3fc183d411bb 100644 --- a/platform/eel/src/com/intellij/platform/eel/EelUserInfo.kt +++ b/platform/eel/src/com/intellij/platform/eel/EelUserInfo.kt @@ -2,16 +2,20 @@ package com.intellij.platform.eel import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus +@ApiStatus.Internal sealed interface EelUserInfo { val home: EelPath } +@ApiStatus.Internal interface EelUserPosixInfo : EelUserInfo { val uid: Int val gid: Int } +@ApiStatus.Internal interface EelUserWindowsInfo : EelUserInfo { // TODO https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-identifiers } \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/ExecuteProcessException.kt b/platform/eel/src/com/intellij/platform/eel/ExecuteProcessException.kt index a2694d459a29..83268bf7515e 100644 --- a/platform/eel/src/com/intellij/platform/eel/ExecuteProcessException.kt +++ b/platform/eel/src/com/intellij/platform/eel/ExecuteProcessException.kt @@ -1,6 +1,8 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.eel +import org.jetbrains.annotations.ApiStatus import java.io.IOException +@ApiStatus.Internal class ExecuteProcessException(val errno: Int, override val message: String) : EelError, IOException() \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/GeneratedBuilder.kt b/platform/eel/src/com/intellij/platform/eel/GeneratedBuilder.kt index 3d240bebd505..bc3dba6195ad 100644 --- a/platform/eel/src/com/intellij/platform/eel/GeneratedBuilder.kt +++ b/platform/eel/src/com/intellij/platform/eel/GeneratedBuilder.kt @@ -1,12 +1,15 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.eel +import org.jetbrains.annotations.ApiStatus + /** * `com.intellij.platform.eel.codegen.BuildersGenerator` generates builders for all methods * that have a single argument with this annotation. */ @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.VALUE_PARAMETER) +@ApiStatus.Internal annotation class GeneratedBuilder { /** * The only purpose of this annotation is to help to find generated builders via "Find Usages". @@ -29,6 +32,7 @@ annotation class GeneratedBuilder { * val result = someApi.someMethod(builder.build()) * ``` */ +@ApiStatus.Internal interface OwnedBuilder { suspend fun eelIt(): T } \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/ReadResult.kt b/platform/eel/src/com/intellij/platform/eel/ReadResult.kt index e9cb1d0a49b8..98aece0ab66b 100644 --- a/platform/eel/src/com/intellij/platform/eel/ReadResult.kt +++ b/platform/eel/src/com/intellij/platform/eel/ReadResult.kt @@ -3,6 +3,7 @@ package com.intellij.platform.eel import com.intellij.platform.eel.ReadResult.EOF import com.intellij.platform.eel.ReadResult.NOT_EOF +import org.jetbrains.annotations.ApiStatus /** @@ -20,6 +21,7 @@ import com.intellij.platform.eel.ReadResult.NOT_EOF * } * ``` */ +@ApiStatus.Internal enum class ReadResult { EOF, NOT_EOF; diff --git a/platform/eel/src/com/intellij/platform/eel/ThrowsChecked.kt b/platform/eel/src/com/intellij/platform/eel/ThrowsChecked.kt index 7b4565766539..b3d617e5e11f 100644 --- a/platform/eel/src/com/intellij/platform/eel/ThrowsChecked.kt +++ b/platform/eel/src/com/intellij/platform/eel/ThrowsChecked.kt @@ -31,7 +31,7 @@ import kotlin.reflect.KClass * } * ``` */ -@ApiStatus.Experimental +@ApiStatus.Internal @Retention(AnnotationRetention.SOURCE) @Target( AnnotationTarget.CONSTRUCTOR, diff --git a/platform/eel/src/com/intellij/platform/eel/annotations/Paths.kt b/platform/eel/src/com/intellij/platform/eel/annotations/Paths.kt index 7422cdfdbd60..ec3a20c2c673 100644 --- a/platform/eel/src/com/intellij/platform/eel/annotations/Paths.kt +++ b/platform/eel/src/com/intellij/platform/eel/annotations/Paths.kt @@ -1,6 +1,8 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.eel.annotations +import org.jetbrains.annotations.ApiStatus + /** * This annotation should be applied to strings that could be directly used to construct [java.nio.file.Path] instances. * These strings are either local to the IDE process or have prefix pointing to the specific environment. @@ -16,6 +18,7 @@ package com.intellij.platform.eel.annotations AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, ) +@ApiStatus.Internal annotation class MultiRoutingFileSystemPath /** @@ -37,6 +40,7 @@ annotation class MultiRoutingFileSystemPath AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, ) +@ApiStatus.Internal annotation class NativePath /** @@ -61,6 +65,7 @@ annotation class NativePath AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, ) +@ApiStatus.Internal annotation class Filename @Retention(AnnotationRetention.SOURCE) @@ -73,4 +78,5 @@ annotation class Filename AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, ) +@ApiStatus.Internal annotation class LocalPath \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/annotations/package-info.java b/platform/eel/src/com/intellij/platform/eel/annotations/package-info.java deleted file mode 100644 index 0ded9a3ed9db..000000000000 --- a/platform/eel/src/com/intellij/platform/eel/annotations/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -@ApiStatus.Internal -package com.intellij.platform.eel.annotations; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/channels/EelLowLevelApi.kt b/platform/eel/src/com/intellij/platform/eel/channels/EelLowLevelApi.kt index d3926ffc7304..680e2422e975 100644 --- a/platform/eel/src/com/intellij/platform/eel/channels/EelLowLevelApi.kt +++ b/platform/eel/src/com/intellij/platform/eel/channels/EelLowLevelApi.kt @@ -1,10 +1,13 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.eel.channels +import org.jetbrains.annotations.ApiStatus + @MustBeDocumented @Retention(value = AnnotationRetention.BINARY) @RequiresOptIn( level = RequiresOptIn.Level.WARNING, message = "This function might send only part of the buffer. Consider using `sendWholeBuffer` instead" ) +@ApiStatus.Internal annotation class EelSendApi \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/channels/EelReceiveChannel.kt b/platform/eel/src/com/intellij/platform/eel/channels/EelReceiveChannel.kt index 4e2835412298..29f66b9f8f4f 100644 --- a/platform/eel/src/com/intellij/platform/eel/channels/EelReceiveChannel.kt +++ b/platform/eel/src/com/intellij/platform/eel/channels/EelReceiveChannel.kt @@ -2,12 +2,13 @@ package com.intellij.platform.eel.channels import com.intellij.platform.eel.ReadResult -import org.jetbrains.annotations.CheckReturnValue +import org.jetbrains.annotations.ApiStatus import java.nio.ByteBuffer /** * Channel to receive data from */ +@ApiStatus.Internal interface EelReceiveChannel { /** * Reads data to [dst] but might read less (see buffer position). diff --git a/platform/eel/src/com/intellij/platform/eel/channels/EelSendChannel.kt b/platform/eel/src/com/intellij/platform/eel/channels/EelSendChannel.kt index 3ecf44e10797..c2ac941bf557 100644 --- a/platform/eel/src/com/intellij/platform/eel/channels/EelSendChannel.kt +++ b/platform/eel/src/com/intellij/platform/eel/channels/EelSendChannel.kt @@ -1,12 +1,13 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.platform.eel.channels -import org.jetbrains.annotations.CheckReturnValue +import org.jetbrains.annotations.ApiStatus import java.nio.ByteBuffer /** * Consumes bytes as buffers. Each [send] writes `0` or more bytes or throws an exception in case of IO error */ +@ApiStatus.Internal interface EelSendChannel { /** * Writes [src], suspends until written. @@ -42,6 +43,7 @@ interface EelSendChannel { * This method is *not* thread-safe (i.e. you can't send two buffers and the same time). */ @OptIn(EelSendApi::class) +@ApiStatus.Internal suspend fun EelSendChannel.sendWholeBuffer(src: ByteBuffer) { if (this is EelSendChannelCustomSendWholeBuffer) { return sendWholeBufferCustom(src) diff --git a/platform/eel/src/com/intellij/platform/eel/channels/package-info.java b/platform/eel/src/com/intellij/platform/eel/channels/package-info.java deleted file mode 100644 index 82c00ed34908..000000000000 --- a/platform/eel/src/com/intellij/platform/eel/channels/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -/** - * Channels are used to send and receive bytes as {@link java.nio.ByteBuffer}. - * This API is pretty much low-level, but other modules contain useful tools to copy channels, pipes, convert them into JVM API, and so on. - */ -@ApiStatus.Internal -@ApiStatus.Experimental -package com.intellij.platform.eel.channels; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/fs/EelFileInfo.kt b/platform/eel/src/com/intellij/platform/eel/fs/EelFileInfo.kt index 1269d8f834ed..1859f48cb643 100644 --- a/platform/eel/src/com/intellij/platform/eel/fs/EelFileInfo.kt +++ b/platform/eel/src/com/intellij/platform/eel/fs/EelFileInfo.kt @@ -2,8 +2,10 @@ package com.intellij.platform.eel.fs import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus import java.time.ZonedDateTime +@ApiStatus.Internal sealed interface EelFileInfo { val type: Type val permissions: Permissions @@ -38,6 +40,7 @@ sealed interface EelFileInfo { } } +@ApiStatus.Internal interface EelPosixFileInfo : EelFileInfo { override val type: Type override val permissions: Permissions @@ -106,6 +109,7 @@ interface EelPosixFileInfo : EelFileInfo { } } +@ApiStatus.Internal interface EelWindowsFileInfo : EelFileInfo { override val permissions: Permissions diff --git a/platform/eel/src/com/intellij/platform/eel/fs/EelFileSystemApi.kt b/platform/eel/src/com/intellij/platform/eel/fs/EelFileSystemApi.kt index 3cf0e1508341..9509cad01af3 100644 --- a/platform/eel/src/com/intellij/platform/eel/fs/EelFileSystemApi.kt +++ b/platform/eel/src/com/intellij/platform/eel/fs/EelFileSystemApi.kt @@ -5,9 +5,11 @@ import com.intellij.platform.eel.* import com.intellij.platform.eel.fs.EelFileSystemApi.StatError import com.intellij.platform.eel.path.EelPath import kotlinx.coroutines.flow.Flow +import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.CheckReturnValue import java.nio.ByteBuffer +@get:ApiStatus.Internal val EelFileSystemApi.pathSeparator: String get() = when (this) { is EelFileSystemPosixApi -> ":" @@ -15,14 +17,17 @@ val EelFileSystemApi.pathSeparator: String else -> throw UnsupportedOperationException("Unsupported OS: ${this::class.java}") } +@ApiStatus.Internal fun EelFileSystemApi.getPath(string: String): EelPath { return EelPath.parse(string, descriptor) } +@ApiStatus.Internal interface LocalEelFileSystemApi : EelFileSystemApi // TODO Integrate case-(in)sensitiveness into the interface. +@ApiStatus.Internal interface EelFileSystemApi { /** @@ -583,6 +588,7 @@ interface EelFileSystemApi { } +@ApiStatus.Internal sealed interface EelOpenedFile { val path: EelPath @@ -716,8 +722,10 @@ sealed interface EelOpenedFile { interface ReaderWriter : Reader, Writer } +@ApiStatus.Internal interface LocalEelFileSystemPosixApi : EelFileSystemPosixApi, LocalEelFileSystemApi +@ApiStatus.Internal interface EelFileSystemPosixApi : EelFileSystemApi { override val user: EelUserPosixInfo @@ -853,8 +861,10 @@ interface EelFileSystemPosixApi : EelFileSystemApi { } } +@ApiStatus.Internal interface LocalEelFileSystemWindowsApi : EelFileSystemWindowsApi, LocalEelFileSystemApi +@ApiStatus.Internal interface EelFileSystemWindowsApi : EelFileSystemApi { override val user: EelUserWindowsInfo @@ -888,6 +898,7 @@ interface EelFileSystemWindowsApi : EelFileSystemApi { @CheckReturnValue @Deprecated("Use the method with the builder") +@ApiStatus.Internal suspend fun EelFileSystemApi.changeAttributes( path: EelPath, setup: (EelFileSystemApi.ChangeAttributesOptions.Builder).() -> Unit, @@ -898,6 +909,7 @@ suspend fun EelFileSystemApi.changeAttributes( @CheckReturnValue @Deprecated("Use the method with the builder") +@ApiStatus.Internal suspend fun EelFileSystemApi.openForWriting(path: EelPath, setup: (EelFileSystemApi.WriteOptions.Builder).() -> Unit): EelResult { val options = EelFileSystemApi.WriteOptions.Builder(path).apply(setup).build() return openForWriting(options) @@ -905,6 +917,7 @@ suspend fun EelFileSystemApi.openForWriting(path: EelPath, setup: (EelFileSystem @CheckReturnValue @Deprecated("Use the method with the builder") +@ApiStatus.Internal suspend fun EelFileSystemApi.copy( source: EelPath, target: EelPath, @@ -916,6 +929,7 @@ suspend fun EelFileSystemApi.copy( @CheckReturnValue @Deprecated("Use the method with the builder") +@ApiStatus.Internal suspend fun EelFileSystemApi.createTemporaryDirectory(setup: (EelFileSystemApi.CreateTemporaryEntryOptions.Builder).() -> Unit): EelResult { val options = EelFileSystemApi.CreateTemporaryEntryOptions.Builder().apply(setup).build() return createTemporaryDirectory(options) diff --git a/platform/eel/src/com/intellij/platform/eel/fs/EelFsError.kt b/platform/eel/src/com/intellij/platform/eel/fs/EelFsError.kt index 1c120f1113a6..438c504e70f6 100644 --- a/platform/eel/src/com/intellij/platform/eel/fs/EelFsError.kt +++ b/platform/eel/src/com/intellij/platform/eel/fs/EelFsError.kt @@ -3,7 +3,9 @@ package com.intellij.platform.eel.fs import com.intellij.platform.eel.EelError import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus +@ApiStatus.Internal sealed interface EelFsError : EelError { val where: EelPath diff --git a/platform/eel/src/com/intellij/platform/eel/fs/EelPosixFileInfoImpl.kt b/platform/eel/src/com/intellij/platform/eel/fs/EelPosixFileInfoImpl.kt index 6a5c5e9e828e..b1498d91beee 100644 --- a/platform/eel/src/com/intellij/platform/eel/fs/EelPosixFileInfoImpl.kt +++ b/platform/eel/src/com/intellij/platform/eel/fs/EelPosixFileInfoImpl.kt @@ -2,8 +2,10 @@ package com.intellij.platform.eel.fs import com.intellij.platform.eel.path.EelPath +import org.jetbrains.annotations.ApiStatus import java.time.ZonedDateTime +@ApiStatus.Internal data class EelPosixFileInfoImpl( override val type: EelPosixFileInfo.Type, override val permissions: EelPosixFileInfo.Permissions, diff --git a/platform/eel/src/com/intellij/platform/eel/fs/package-info.java b/platform/eel/src/com/intellij/platform/eel/fs/package-info.java deleted file mode 100644 index d489bb88e5f0..000000000000 --- a/platform/eel/src/com/intellij/platform/eel/fs/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -/** - * This package is only for EEL API implementers. Do not use it. - */ -@ApiStatus.Internal -package com.intellij.platform.eel.fs; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/package-info.java b/platform/eel/src/com/intellij/platform/eel/package-info.java deleted file mode 100644 index dc758a2101f8..000000000000 --- a/platform/eel/src/com/intellij/platform/eel/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -/** - * EEL API provides the same API for local and non-local (ssh/wsl/etc) system - */ -@ApiStatus.Internal -package com.intellij.platform.eel; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file diff --git a/platform/eel/src/com/intellij/platform/eel/path/EelPath.kt b/platform/eel/src/com/intellij/platform/eel/path/EelPath.kt index 8b430d005b7e..8fe9d1aa2bfe 100644 --- a/platform/eel/src/com/intellij/platform/eel/path/EelPath.kt +++ b/platform/eel/src/com/intellij/platform/eel/path/EelPath.kt @@ -3,7 +3,9 @@ package com.intellij.platform.eel.path import com.intellij.platform.eel.EelDescriptor import com.intellij.platform.eel.EelPlatform +import org.jetbrains.annotations.ApiStatus +@get:ApiStatus.Internal val EelPath.platform: EelPlatform get() = descriptor.platform /** @@ -16,6 +18,7 @@ val EelPath.platform: EelPlatform get() = descriptor.platform * * All operations listed here do not require I/O. */ +@ApiStatus.Internal sealed interface EelPath { companion object { @Throws(EelPathException::class) @@ -156,6 +159,8 @@ sealed interface EelPath { } } +@ApiStatus.Internal operator fun EelPath.div(part: String): EelPath = resolve(part) +@ApiStatus.Internal class EelPathException(val raw: String, val reason: String) : RuntimeException("`$raw`: $reason") diff --git a/platform/eel/src/com/intellij/platform/eel/path/package-info.java b/platform/eel/src/com/intellij/platform/eel/path/package-info.java deleted file mode 100644 index 9145e1548f98..000000000000 --- a/platform/eel/src/com/intellij/platform/eel/path/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -@ApiStatus.Internal -package com.intellij.platform.eel.path; - -import org.jetbrains.annotations.ApiStatus; \ No newline at end of file