IJPL-188144 Eel: add @ThrowsChecked annotation to various methods in Eel*Api

GitOrigin-RevId: d62db98ab62b9e359d170c27a7de5d39e67ccb5e
This commit is contained in:
Vladimir Lagunov
2025-05-21 16:21:41 +00:00
committed by intellij-monorepo-bot
parent dfc096f7de
commit 64beee59f2
7 changed files with 13 additions and 4 deletions
@@ -73,6 +73,7 @@ import java.nio.file.Files
import java.nio.file.Path
import java.util.Optional
import java.util.TreeSet
import kotlin.Boolean
import kotlin.Char
import kotlin.OptIn
import kotlin.Pair
@@ -331,7 +332,7 @@ class BuildersGeneratorTest {
var genSrcDirName: Path? = null
val ultimateProject: JpsProject = IntelliJProjectConfiguration.loadIntelliJProject(Path.of(PathManager.getHomePath()).pathString)
val libraries = mutableListOf<JpsLibrary>()
val libraries = mutableSetOf<JpsLibrary>()
val newEelModule: Module = writeAction {
val projectModel = ModuleManager.getInstance(tempProject).getModifiableModel()
@@ -461,7 +462,7 @@ private fun findBuilders(psiFile: PsiFile, methods: MutableList<BuilderRequest>)
methods += BuilderRequest(
shouldCheckReturnValue = fn.annotationEntries.mapNotNull { it.shortName?.asString() }.contains("CheckReturnValue"),
deprecatedAnnotation = fn.annotationEntries.find { it.shortName?.asString() == "Deprecated" }?.text?.trim(),
throwsAnnotation = fn.annotationEntries.find { it.shortName?.asString() == "Throws" }?.text?.trim(),
throwsAnnotation = fn.annotationEntries.filter { it.shortName?.asString() in listOf("Throws", "ThrowsChecked") }.joinToString(" ") { it.text.trim() },
argsInterfaceFqn = typeFqn,
clsFqn = methodCls.asString(),
methodName = methodName,
@@ -215,6 +215,7 @@ object EelExecApiHelpers {
* with an instance of [com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions].
*/
@Throws(ExecuteProcessException::class)
@ThrowsChecked(ExecuteProcessException::class)
override suspend fun eelIt(): EelProcess =
owner.spawnProcess(
ExecuteProcessOptionsImpl(
@@ -101,6 +101,7 @@ object EelExecPosixApiHelpers {
* Complete the builder and call [com.intellij.platform.eel.EelExecPosixApi.spawnProcess]
* with an instance of [com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions].
*/
@ThrowsChecked(ExecuteProcessException::class)
override suspend fun eelIt(): EelPosixProcess =
owner.spawnProcess(
ExecuteProcessOptionsImpl(
@@ -101,6 +101,7 @@ object EelExecWindowsApiHelpers {
* Complete the builder and call [com.intellij.platform.eel.EelExecWindowsApi.spawnProcess]
* with an instance of [com.intellij.platform.eel.EelExecApi.ExecuteProcessOptions].
*/
@ThrowsChecked(ExecuteProcessException::class)
override suspend fun eelIt(): EelWindowsProcess =
owner.spawnProcess(
ExecuteProcessOptionsImpl(
@@ -128,6 +128,7 @@ object EelTunnelsApiHelpers {
* with an instance of [com.intellij.platform.eel.EelTunnelsApi.GetAcceptorForRemotePort].
*/
@Throws(EelConnectionError::class)
@ThrowsChecked(EelConnectionError::class)
override suspend fun eelIt(): EelTunnelsApi.ConnectionAcceptor =
owner.getAcceptorForRemotePort(
GetAcceptorForRemotePortImpl(
@@ -198,6 +199,7 @@ object EelTunnelsApiHelpers {
* with an instance of [com.intellij.platform.eel.EelTunnelsApi.GetConnectionToRemotePortArgs].
*/
@Throws(EelConnectionError::class)
@ThrowsChecked(EelConnectionError::class)
override suspend fun eelIt(): Connection =
owner.getConnectionToRemotePort(
GetConnectionToRemotePortArgsImpl(
@@ -13,6 +13,7 @@ sealed interface EelExecApi {
val descriptor: EelDescriptor
@Throws(ExecuteProcessException::class)
@ThrowsChecked(ExecuteProcessException::class)
suspend fun spawnProcess(@GeneratedBuilder generatedBuilder: ExecuteProcessOptions): EelProcess
/**
@@ -134,10 +135,12 @@ sealed interface EelExecApi {
}
interface EelExecPosixApi : EelExecApi {
@ThrowsChecked(ExecuteProcessException::class)
override suspend fun spawnProcess(@GeneratedBuilder generatedBuilder: ExecuteProcessOptions): EelPosixProcess
}
interface EelExecWindowsApi : EelExecApi {
@ThrowsChecked(ExecuteProcessException::class)
override suspend fun spawnProcess(@GeneratedBuilder generatedBuilder: ExecuteProcessOptions): EelWindowsProcess
}
@@ -8,9 +8,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.coroutineScope
import org.jetbrains.annotations.CheckReturnValue
import java.io.IOException
import kotlin.jvm.Throws
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
@@ -85,6 +83,7 @@ sealed interface EelTunnelsApi {
* To configure a socket before connection use [configureSocketBeforeConnection]. After that, use [Connection.configureSocket]
*/
@Throws(EelConnectionError::class)
@ThrowsChecked(EelConnectionError::class)
suspend fun getConnectionToRemotePort(@GeneratedBuilder args: GetConnectionToRemotePortArgs): Connection
interface GetConnectionToRemotePortArgs : HostAddress {
@@ -239,6 +238,7 @@ sealed interface EelTunnelsApi {
* One should not forget to invoke [Connection.close] when the connection is not needed.
*/
@Throws(EelConnectionError::class)
@ThrowsChecked(EelConnectionError::class)
suspend fun getAcceptorForRemotePort(@GeneratedBuilder args: GetAcceptorForRemotePort): ConnectionAcceptor
interface GetAcceptorForRemotePort : HostAddress {