IJPL-238173 [rpc] Introduce more restrictions to avoid marking too many kotlin&rpc internals as a part of api surface

The suggested state is sufficient for accessing classes and checking instances, but it prevents from creating new instances of platform primitives with seems a fair trade-off


(cherry picked from commit 3a8fded5db91dad3d34f6dfe6184aca583a78440)

IJ-CR-195627

GitOrigin-RevId: 0a92cad5b21687318d726fbc4bb7647f4afcb97c
This commit is contained in:
Nikita Katkov
2026-03-11 17:30:54 +00:00
committed by intellij-monorepo-bot
parent ab0fc99020
commit b6fd6c1bca
7 changed files with 18 additions and 33 deletions
-22
View File
@@ -1,60 +1,38 @@
fleet.rpc.RemoteApi
fleet.rpc.RemoteApiDescriptor
- a:call(fleet.rpc.RemoteApi,java.lang.String,java.lang.Object[],kotlin.coroutines.Continuation):java.lang.Object
- a:clientStub(kotlin.jvm.functions.Function3):fleet.rpc.RemoteApi
- a:getApiFqn():java.lang.String
- a:getSignature(java.lang.String):fleet.rpc.RpcSignature
@:fleet.rpc.Rpc
- java.lang.annotation.Annotation
f:fleet.rpc.client.DurableKt
- sf:durable(Z,kotlin.jvm.functions.Function2,kotlin.coroutines.Continuation):java.lang.Object
- bs:durable$default(Z,kotlin.jvm.functions.Function2,kotlin.coroutines.Continuation,I,java.lang.Object):java.lang.Object
f:fleet.rpc.client.FleetClientKt
- sf:fleetClient(fleet.rpc.client.ClientId,fleet.rpc.core.TransportFactory,Z,fleet.util.async.DelayStrategy,fleet.rpc.client.RpcInterceptor,java.lang.String):fleet.util.async.Resource
- bs:fleetClient$default(fleet.rpc.client.ClientId,fleet.rpc.core.TransportFactory,Z,fleet.util.async.DelayStrategy,fleet.rpc.client.RpcInterceptor,java.lang.String,I,java.lang.Object):fleet.util.async.Resource
- sf:proxy(fleet.rpc.client.FleetClient,fleet.rpc.RemoteApiDescriptor,fleet.util.UID,fleet.rpc.core.InstanceId):fleet.rpc.RemoteApi
f:fleet.rpc.client.RemoteIsCancelledException
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(java.lang.String,java.lang.Throwable):V
- createCopy():fleet.rpc.client.RemoteIsCancelledException
f:fleet.rpc.client.RouteClosedException
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(fleet.util.UID,java.lang.String,java.lang.Throwable):V
- b:<init>(fleet.util.UID,java.lang.String,java.lang.Throwable,I,kotlin.jvm.internal.DefaultConstructorMarker):V
- createCopy():fleet.rpc.client.RouteClosedException
- f:getRoute():fleet.util.UID
f:fleet.rpc.client.RpcCausalityTimeout
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(java.lang.String,java.lang.Throwable):V
- createCopy():fleet.rpc.client.RpcCausalityTimeout
f:fleet.rpc.client.RpcClientDisconnectedException
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(java.lang.String,java.lang.Throwable):V
- createCopy():fleet.rpc.client.RpcClientDisconnectedException
a:fleet.rpc.client.RpcClientException
- java.lang.RuntimeException
- <init>(java.lang.String,java.lang.Throwable):V
f:fleet.rpc.client.RpcServiceNotReady
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(fleet.rpc.core.RpcMessage$CallRequest,java.lang.Throwable):V
- b:<init>(fleet.rpc.core.RpcMessage$CallRequest,java.lang.Throwable,I,kotlin.jvm.internal.DefaultConstructorMarker):V
- createCopy():fleet.rpc.client.RpcServiceNotReady
f:fleet.rpc.client.RpcTimeoutException
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(java.lang.String,java.lang.Throwable):V
- b:<init>(java.lang.String,java.lang.Throwable,I,kotlin.jvm.internal.DefaultConstructorMarker):V
- createCopy():fleet.rpc.client.RpcTimeoutException
- f:getMsg():java.lang.String
f:fleet.rpc.client.UnresolvedServiceException
- fleet.rpc.client.RpcClientException
- kotlinx.coroutines.CopyableThrowable
- <init>(fleet.rpc.core.InstanceId,java.lang.Throwable):V
- b:<init>(fleet.rpc.core.InstanceId,java.lang.Throwable,I,kotlin.jvm.internal.DefaultConstructorMarker):V
- createCopy():fleet.rpc.client.UnresolvedServiceException
- f:getServiceId():fleet.rpc.core.InstanceId
@@ -56,9 +56,13 @@ data class ParameterDescriptor(val parameterName: String, val parameterKind: Rem
data class RpcSignature(val methodName: String, val parameters: Array<ParameterDescriptor>, val returnType: RemoteKind)
interface RemoteApiDescriptor<T : RemoteApi<*>> {
@ApiStatus.Internal
fun getSignature(methodName: String): RpcSignature
@ApiStatus.Internal
fun clientStub(proxy: suspend (String, Array<Any?>) -> Any?): T
@ApiStatus.Internal
fun getApiFqn(): String
@ApiStatus.Internal
suspend fun call(impl: T, methodName: String, args: Array<Any?>): Any?
}
@@ -59,9 +59,11 @@ class FleetClient internal constructor(
}
}
@ApiStatus.Internal
fun <A : RemoteApi<*>> FleetClient.proxy(remoteApiDescriptor: RemoteApiDescriptor<A>, route: UID, instanceId: InstanceId): A =
asServiceProxy().proxy(remoteApiDescriptor, route, instanceId)
@ApiStatus.Internal
fun fleetClient(
clientId: ClientId,
transportFactory: FleetTransportFactory,
@@ -5,18 +5,20 @@ import fleet.rpc.core.InstanceId
import fleet.rpc.core.RpcMessage
import fleet.util.UID
import kotlinx.coroutines.CopyableThrowable
import org.jetbrains.annotations.ApiStatus
/**
* Base class for all exceptions that will be retried by [durable]
* */
abstract class RpcClientException(message: String?, cause: Throwable?) : RuntimeException(message, cause)
abstract class RpcClientException @ApiStatus.Internal constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause)
/**
* Thrown when the remote service designated by [route] is offline (maybe temporarily).
*
* see [RpcClientException]
* */
class RouteClosedException(val route: UID, message: String, cause: Throwable? = null)
class RouteClosedException @ApiStatus.Internal constructor(@ApiStatus.Internal val route: UID, message: String, cause: Throwable? = null)
: RpcClientException(message, cause),
CopyableThrowable<RouteClosedException> {
@@ -30,7 +32,7 @@ class RouteClosedException(val route: UID, message: String, cause: Throwable? =
*
* see [RpcClientException]
* */
class RpcTimeoutException(val msg: String, cause: Throwable? = null)
class RpcTimeoutException @ApiStatus.Internal constructor(val msg: String, cause: Throwable? = null)
: RpcClientException(msg, cause),
CopyableThrowable<RpcTimeoutException> {
override fun createCopy(): RpcTimeoutException {
@@ -38,7 +40,7 @@ class RpcTimeoutException(val msg: String, cause: Throwable? = null)
}
}
class RpcServiceNotReady(private val req: RpcMessage.CallRequest, cause: Throwable? = null)
class RpcServiceNotReady @ApiStatus.Internal constructor(private val req: RpcMessage.CallRequest, cause: Throwable? = null)
: RpcClientException("Service not ready: ${req.service}$${req.method}", cause),
CopyableThrowable<RpcServiceNotReady> {
override fun createCopy(): RpcServiceNotReady {
@@ -46,7 +48,7 @@ class RpcServiceNotReady(private val req: RpcMessage.CallRequest, cause: Throwab
}
}
class UnresolvedServiceException(val serviceId: InstanceId, cause: Throwable? = null)
class UnresolvedServiceException @ApiStatus.Internal constructor(@ApiStatus.Internal val serviceId: InstanceId, cause: Throwable? = null)
: RpcClientException("Service not found: ${serviceId}", cause),
CopyableThrowable<UnresolvedServiceException> {
override fun createCopy(): UnresolvedServiceException {
@@ -59,7 +61,7 @@ class UnresolvedServiceException(val serviceId: InstanceId, cause: Throwable? =
*
* see [RpcClientException]
* */
class RpcClientDisconnectedException(reason: String?, cause: Throwable?)
class RpcClientDisconnectedException @ApiStatus.Internal constructor(reason: String?, cause: Throwable?)
: RpcClientException(reason, cause),
CopyableThrowable<RpcClientDisconnectedException> {
override fun createCopy(): RpcClientDisconnectedException {
@@ -67,7 +69,7 @@ class RpcClientDisconnectedException(reason: String?, cause: Throwable?)
}
}
class RpcCausalityTimeout(msg: String?, cause: Throwable?)
class RpcCausalityTimeout @ApiStatus.Internal constructor(msg: String?, cause: Throwable?)
: RpcClientException(msg, cause),
CopyableThrowable<RpcCausalityTimeout> {
override fun createCopy(): RpcCausalityTimeout {
@@ -80,7 +82,7 @@ class RpcCausalityTimeout(msg: String?, cause: Throwable?)
*
* see [RpcClientException]
* */
class RemoteIsCancelledException(msg: String?, cause: Throwable?)
class RemoteIsCancelledException @ApiStatus.Internal constructor(msg: String?, cause: Throwable?)
: RpcClientException(msg, cause),
CopyableThrowable<RemoteIsCancelledException> {
override fun createCopy(): RemoteIsCancelledException {
@@ -6,7 +6,6 @@ com/google/gson/reflect/TypeToken
com/google/gson/stream/JsonToken
com/intellij/util/ui/MenuItemLayoutHelper
com/intellij/util/ui/MenuItemLayoutHelper$LayoutResult
fleet/util/UID
io/netty/buffer/ByteBuf
it/unimi/dsi/fastutil/longs/Long2ObjectMap
it/unimi/dsi/fastutil/longs/Long2ObjectOpenHashMap
@@ -1,5 +1,4 @@
fleet/util/UID
kotlinx/serialization/descriptors/SerialDescriptor
kotlinx/serialization/encoding/Decoder
kotlinx/serialization/encoding/Encoder
kotlinx/serialization/internal/GeneratedSerializer
kotlinx/serialization/internal/GeneratedSerializer
@@ -1,3 +1,4 @@
fleet/util/UID
java/awt/*
java/awt/color/ColorSpace
java/awt/datatransfer/*