From b98d6013deda49c0a96e95f1b93f4baf7299b1bc Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Thu, 25 Sep 2025 10:13:30 -0400 Subject: [PATCH 1/2] Upgrade LangChain4j 1.5.0; Fix deprecated warnings Signed-off-by: Ricardo Zanini --- .../java/io/serverlessworkflow/api/ObjectMapperFactory.java | 6 +++--- .../io/serverlessworkflow/impl/WorkflowModelFactory.java | 5 +---- .../java/io/serverlessworkflow/impl/jackson/JsonUtils.java | 4 +++- .../java/io/serverlessworkflow/impl/jackson/MergeUtils.java | 5 +---- .../impl/test/OpenIDCHTTPWorkflowDefinitionTest.java | 5 +++-- pom.xml | 5 ++--- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java b/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java index 25a3f2a2..4c7393d0 100644 --- a/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java +++ b/api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java @@ -34,11 +34,11 @@ class ObjectMapperFactory { private static final ObjectMapper yamlMapper = configure(new ObjectMapper(new YAMLFactory().enable(Feature.MINIMIZE_QUOTES))); - public static final ObjectMapper jsonMapper() { + public static ObjectMapper jsonMapper() { return jsonMapper; } - public static final ObjectMapper yamlMapper() { + public static ObjectMapper yamlMapper() { return yamlMapper; } @@ -49,7 +49,7 @@ private static ObjectMapper configure(ObjectMapper mapper) { validationModule.setDeserializerModifier(new BeanDeserializerModifierWithValidation()); return mapper - .setSerializationInclusion(Include.NON_NULL) + .setDefaultPropertyInclusion(Include.NON_NULL) .configure(SerializationFeature.INDENT_OUTPUT, true) .configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false) .configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false) diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowModelFactory.java b/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowModelFactory.java index 1475b71e..a65e930f 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowModelFactory.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowModelFactory.java @@ -51,6 +51,7 @@ default WorkflowModel fromAny(WorkflowModel prev, Object obj) { return fromAny(obj); } + @SuppressWarnings("unchecked") default WorkflowModel fromAny(Object obj) { if (obj == null) { return fromNull(); @@ -70,10 +71,6 @@ default WorkflowModel fromAny(Object obj) { return from((Map) obj); } else if (obj instanceof WorkflowModel model) { return model; - } else if (obj instanceof CloudEventData ce) { - return from(ce); - } else if (obj instanceof CloudEvent ce) { - return from(ce); } else { return fromOther(obj); } diff --git a/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/JsonUtils.java b/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/JsonUtils.java index 6434c6f5..146df093 100644 --- a/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/JsonUtils.java +++ b/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/JsonUtils.java @@ -162,7 +162,9 @@ public static JsonNode fromString(String value) { private static Object toJavaValue(ObjectNode node) { Map result = new HashMap<>(); - node.fields().forEachRemaining(iter -> result.put(iter.getKey(), toJavaValue(iter.getValue()))); + node.properties() + .iterator() + .forEachRemaining(iter -> result.put(iter.getKey(), toJavaValue(iter.getValue()))); return result; } diff --git a/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/MergeUtils.java b/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/MergeUtils.java index aca5d63d..a94b7ff1 100644 --- a/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/MergeUtils.java +++ b/impl/jackson/src/main/java/io/serverlessworkflow/impl/jackson/MergeUtils.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.HashSet; -import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -56,9 +55,7 @@ public static JsonNode merge(JsonNode src, JsonNode target, boolean mergeArray) private static ObjectNode mergeObject(JsonNode src, ObjectNode target, boolean mergeArray) { if (src.isObject()) { - Iterator> mergedIterator = src.fields(); - while (mergedIterator.hasNext()) { - Map.Entry entry = mergedIterator.next(); + for (Map.Entry entry : src.properties()) { JsonNode found = target.get(entry.getKey()); target.set( entry.getKey(), diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java index 7cecf9e5..f4c7a889 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java @@ -17,7 +17,7 @@ import static io.serverlessworkflow.api.WorkflowReader.readWorkflowFromClasspath; import static io.serverlessworkflow.impl.test.OAuthHTTPWorkflowDefinitionTest.fakeAccessToken; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import com.fasterxml.jackson.databind.ObjectMapper; @@ -482,7 +482,8 @@ public void testOpenIDCJSONWithArgsNoEndPointWorkflowExecution() throws Exceptio RecordedRequest tokenRequest = authServer.takeRequest(); assertEquals("POST", tokenRequest.getMethod()); - assertEquals("/realms/test-realm/protocol/openid-connect/token", tokenRequest.getPath()); + assertEquals( + "/realms/test-realm/protocol/openid-connect/token", tokenRequest.getPath()); assertEquals("application/json", tokenRequest.getHeader("Content-Type")); String tokenRequestBody = tokenRequest.getBody().readUtf8(); diff --git a/pom.xml b/pom.xml index 96faa82a..d838ea30 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,6 @@ 17 ${java.version} - ${java.version} UTF-8 3.9.11 @@ -94,9 +93,9 @@ 9.0.1.Final 6.0.0 - 1.4.1-beta10 + 1.5.0-beta11 - 1.4.0 + 1.5.0 true From 18971290a2181a7a31bd89d3c7b4b5ede932fc49 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Thu, 25 Sep 2025 10:41:02 -0400 Subject: [PATCH 2/2] Fix maven-compiler-plugin-s --- .../impl/test/OpenIDCHTTPWorkflowDefinitionTest.java | 3 +-- pom.xml | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java index f4c7a889..5c038f62 100644 --- a/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java +++ b/impl/test/src/test/java/io/serverlessworkflow/impl/test/OpenIDCHTTPWorkflowDefinitionTest.java @@ -482,8 +482,7 @@ public void testOpenIDCJSONWithArgsNoEndPointWorkflowExecution() throws Exceptio RecordedRequest tokenRequest = authServer.takeRequest(); assertEquals("POST", tokenRequest.getMethod()); - assertEquals( - "/realms/test-realm/protocol/openid-connect/token", tokenRequest.getPath()); + assertEquals("/realms/test-realm/protocol/openid-connect/token", tokenRequest.getPath()); assertEquals("application/json", tokenRequest.getHeader("Content-Type")); String tokenRequestBody = tokenRequest.getBody().readUtf8(); diff --git a/pom.xml b/pom.xml index d838ea30..3be3738f 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,7 @@ 17 ${java.version} + ${java.version} UTF-8 3.9.11 @@ -308,10 +309,6 @@ true true - ${maven.compiler.source} - ${maven.compiler.target} - ${maven.compiler.source} - ${maven.compiler.target} true -Xlint:unchecked