Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {


dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
implementation("org.jetbrains.kotlin:kotlin-serialization:2.0.21")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.10")
implementation("org.jetbrains.kotlin:kotlin-serialization:2.2.10")
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.2.1")
}
5 changes: 2 additions & 3 deletions client/src/main/java/dev/restate/client/base/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.stream.Stream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

Expand Down Expand Up @@ -358,7 +357,7 @@ protected abstract <Res> CompletableFuture<Res> doPostRequest(
protected abstract <Res> CompletableFuture<Res> doGetRequest(
URI target, Stream<Map.Entry<String, String>> headers, ResponseMapper<Res> responseMapper);

private <Res> @NotNull ResponseMapper<Response<Res>> callResponseMapper(
private <Res> @NonNull ResponseMapper<Response<Res>> callResponseMapper(
String requestMethod, URI requestUri, Serde<Res> resSerde) {
return (statusCode, responseHeaders, responseBody) -> {
if (statusCode >= 300) {
Expand Down Expand Up @@ -389,7 +388,7 @@ protected abstract <Res> CompletableFuture<Res> doGetRequest(
};
}

private <Res> @NotNull ResponseMapper<Response<Output<Res>>> getOutputResponseMapper(
private <Res> @NonNull ResponseMapper<Response<Output<Res>>> getOutputResponseMapper(
String requestMethod, URI requestUri, Serde<Res> resSerde) {
return (statusCode, responseHeaders, responseBody) -> {
if (statusCode == 470) {
Expand Down
15 changes: 7 additions & 8 deletions common/src/main/java/dev/restate/serde/Serde.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@
*
* @see SerdeFactory
*/
@NullMarked
public interface Serde<T extends @Nullable Object> extends TypeTag<T> {

Slice serialize(T value);

T deserialize(Slice value);
T deserialize(@NonNull Slice value);

// --- Metadata about the serialized/deserialized content

Expand Down Expand Up @@ -72,7 +71,7 @@ public Slice serialize(T value) {
}

@Override
public T deserialize(Slice value) {
public T deserialize(@NonNull Slice value) {
return deserializer.asFunction().apply(value.toByteArray());
}
};
Expand All @@ -93,7 +92,7 @@ public Slice serialize(T value) {
}

@Override
public T deserialize(Slice value) {
public T deserialize(@NonNull Slice value) {
return deserializer.asFunction().apply(value.toByteArray());
}

Expand All @@ -112,7 +111,7 @@ public Slice serialize(T value) {
}

@Override
public T deserialize(Slice value) {
public T deserialize(@NonNull Slice value) {
return inner.deserialize(value);
}

Expand All @@ -132,7 +131,7 @@ public Slice serialize(Void value) {
}

@Override
public Void deserialize(Slice value) {
public Void deserialize(@NonNull Slice value) {
return null;
}

Expand All @@ -151,7 +150,7 @@ public Slice serialize(byte[] value) {
}

@Override
public byte[] deserialize(Slice value) {
public byte[] deserialize(@NonNull Slice value) {
return value.toByteArray();
}
};
Expand All @@ -165,7 +164,7 @@ public Slice serialize(Slice value) {
}

@Override
public Slice deserialize(Slice value) {
public Slice deserialize(@NonNull Slice value) {
return value;
}
};
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@
ref = 'victools-json-schema'

[plugins]
aggregate-javadoc = 'io.freefair.aggregate-javadoc:8.6'
dependency-license-report = 'com.github.jk1.dependency-license-report:2.0'
aggregate-javadoc = 'io.freefair.aggregate-javadoc:8.14'
dependency-license-report = 'com.github.jk1.dependency-license-report:2.9'
dokka = 'org.jetbrains.dokka:1.9.20'
jib = 'com.google.cloud.tools.jib:3.4.4'
jsonschema2pojo = 'org.jsonschema2pojo:1.2.1'
nexus-publish = 'io.github.gradle-nexus.publish-plugin:1.3.0'
openapi-generator = 'org.openapi.generator:7.5.0'
protobuf = 'com.google.protobuf:0.9.4'
shadow = 'com.gradleup.shadow:9.0.0-beta8'
spotless = 'com.diffplug.spotless:6.25.0'
spotless = 'com.diffplug.spotless:7.2.1'
spring-dependency-management = 'io.spring.dependency-management:1.1.6'

[plugins.ksp]
Expand All @@ -221,14 +221,14 @@
[versions]
jackson = '2.18.1'
junit = '5.10.2'
kotlinx-coroutines = '1.9.0'
kotlinx-serialization = '1.7.3'
ksp = '2.0.21-1.0.28'
kotlinx-coroutines = '1.10.2'
kotlinx-serialization = '1.9.0'
ksp = '2.2.10-2.0.2'
log4j = '2.24.2'
opentelemetry = '1.47.0'
protobuf = '4.29.3'
restate = '2.3.0-SNAPSHOT'
schema-kenerator = '2.1.2'
spring-boot = '3.4.5'
vertx = '4.5.16'
vertx = '4.5.18'
victools-json-schema = '4.38.0'
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ internal abstract class BaseDurableFutureImpl<T : Any?> : DurableFuture<T> {
}

try {
@Suppress("UNCHECKED_CAST") return@simpleMap this.asyncResult().poll().getNow(null) as T
@Suppress("UNCHECKED_CAST")
return@simpleMap this.asyncResult().poll().getNow(null) as T
} catch (e: ExecutionException) {
throw e.cause ?: e // unwrap original cause from ExecutionException
}
Expand Down
2 changes: 1 addition & 1 deletion sdk-api/src/main/java/dev/restate/sdk/JsonSerdes.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public Slice serialize(T value) {
}

@Override
public T deserialize(Slice value) {
public T deserialize(@NonNull Slice value) {
ByteArrayInputStream inputStream = new ByteArrayInputStream(value.toByteArray());
try (JsonParser parser = JSON_FACTORY.createParser(inputStream)) {
return deserializer.asFunction().apply(parser);
Expand Down
3 changes: 2 additions & 1 deletion sdk-core/src/test/java/dev/restate/sdk/core/TestSerdes.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

/**
Expand Down Expand Up @@ -124,7 +125,7 @@ public Slice serialize(@Nullable T value) {
}

@Override
public T deserialize(Slice value) {
public T deserialize(@NonNull Slice value) {
ByteArrayInputStream inputStream = new ByteArrayInputStream(value.toByteArray());
try (JsonParser parser = JSON_FACTORY.createParser(inputStream)) {
return deserializer.asFunction().apply(parser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ThreadTrampoliningTestSuite : TestDefinitions.TestSuite {

private fun checkBlockingComponentTrampolineExecutor(
ctx: dev.restate.sdk.Context,
_unused: Any
_unused: Any?
): Void? {
val id = Thread.currentThread().id
check(Vertx.currentContext() == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ constructor(
val UNIT: Serde<Unit> =
object : Serde<Unit> {
// This is fine, it's less strict
@Suppress("WRONG_NULLABILITY_FOR_JAVA_OVERRIDE")
override fun serialize(value: Unit?): Slice {
return Slice.EMPTY
}
Expand All @@ -119,7 +118,6 @@ constructor(
val schema = jsonSchemaFactory.generateSchema(json, serializer)

return object : Serde<T> {
@Suppress("WRONG_NULLABILITY_FOR_JAVA_OVERRIDE")
override fun serialize(value: T?): Slice {
if (value == null) {
return Slice.wrap(json.encodeToString(JsonNull.serializer(), JsonNull))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class RestateHttpEndpointBeanTest {
.readValue<EndpointManifestSchema>(response.body(), EndpointManifestSchema::class.java)

Assertions.assertThat<Service?>(endpointManifest.services)
.map<String>({ it.name })
.map<String> { it?.name }
.containsOnly("greeter")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TestUtilsServiceImpl : TestUtilsService {
override suspend fun countExecutedSideEffects(context: Context, increments: Int): Int {
val invokedSideEffects = AtomicInteger(0)

for (i in 0 ..< increments) {
for (i in 0..<increments) {
context.runBlock { invokedSideEffects.incrementAndGet() }
}

Expand Down