refactor(core): Fix Kotlin language and api version to 2.1 in build config (#620)
## Fix Kotlin language and api version to 2.1 - Remove language constructs not supported in Kotlin 2.1 <!-- Provide a brief summary of your changes --> ## Motivation and Context To ensure binary compatibility ## How Has This Been Tested? Regression tests ## Breaking Changes <!-- Will users need to update their code or configurations? --> ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Build update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions -->
This commit is contained in:
parent
cd91eed35d
commit
c77ebe0c00
2 changed files with 19 additions and 17 deletions
|
|
@ -16,9 +16,9 @@ import kotlin.jvm.JvmInline
|
|||
public value class RequestMeta(public val json: JsonObject) {
|
||||
public val progressToken: ProgressToken?
|
||||
get() = json["progressToken"]?.let { element ->
|
||||
when (element) {
|
||||
is JsonPrimitive if (element.isString) -> ProgressToken(element.content)
|
||||
is JsonPrimitive if (element.longOrNull != null) -> ProgressToken(element.long)
|
||||
when {
|
||||
element is JsonPrimitive && element.isString -> ProgressToken(element.content)
|
||||
element is JsonPrimitive && element.longOrNull != null -> ProgressToken(element.long)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,9 +414,9 @@ internal object JSONRPCMessagePolymorphicSerializer :
|
|||
* Supports both string and number IDs.
|
||||
*/
|
||||
internal object RequestIdPolymorphicSerializer : JsonContentPolymorphicSerializer<RequestId>(RequestId::class) {
|
||||
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<RequestId> = when (element) {
|
||||
is JsonPrimitive if (element.isString) -> RequestId.StringId.serializer()
|
||||
is JsonPrimitive if (element.longOrNull != null) -> RequestId.NumberId.serializer()
|
||||
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<RequestId> = when {
|
||||
element is JsonPrimitive && element.isString -> RequestId.StringId.serializer()
|
||||
element is JsonPrimitive && element.longOrNull != null -> RequestId.NumberId.serializer()
|
||||
else -> throw SerializationException("Invalid RequestId type: $element")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue