From 3f1358b42011e78ef9f20234401a125a6fc7d8fd Mon Sep 17 00:00:00 2001 From: Zhoujie628 Date: Thu, 17 Sep 2026 14:38:19 +0800 Subject: [PATCH 1/2] style: add JSpecify @NullMarked to match SDK null-safety contract The A2A Java SDK annotates its interfaces with JSpecify @NullMarked; classes overriding those interfaces without the annotation trigger IDEA inspection warnings. Add @NullMarked to the client and spring packages via package-info.java (fully qualified annotation name to avoid import parsing issues in package-info), with jspecify as a provided-scope dependency. Also upgrade google-java-format to 1.24.0 and exclude package-info.java from spotless (google-java-format cannot parse it). Signed-off-by: Zhoujie628 --- pom.xml | 6 ++++- spring-boot-starter/pom.xml | 6 +++++ .../workflow/engine/spring/package-info.java | 24 +++++++++++++++++++ workflow-engine/pom.xml | 7 ++++++ .../workflow/engine/client/package-info.java | 3 ++- 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 spring-boot-starter/src/main/java/dev/openan/workflow/engine/spring/package-info.java diff --git a/pom.xml b/pom.xml index 3234d06..f73751d 100644 --- a/pom.xml +++ b/pom.xml @@ -174,8 +174,12 @@ 2.46.1 + + + **/package-info.java + - 1.22.0 + 1.24.0 diff --git a/spring-boot-starter/pom.xml b/spring-boot-starter/pom.xml index 4340889..f67bdb8 100644 --- a/spring-boot-starter/pom.xml +++ b/spring-boot-starter/pom.xml @@ -75,6 +75,12 @@ ${spring-boot.version} test + + org.jspecify + jspecify + 1.0.0 + provided + diff --git a/spring-boot-starter/src/main/java/dev/openan/workflow/engine/spring/package-info.java b/spring-boot-starter/src/main/java/dev/openan/workflow/engine/spring/package-info.java new file mode 100644 index 0000000..e608b77 --- /dev/null +++ b/spring-boot-starter/src/main/java/dev/openan/workflow/engine/spring/package-info.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2026 Huawei Technologies Co., Ltd. + * All Rights Reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/** + * Spring Boot auto-configuration for the A2A server side. + */ +@org.jspecify.annotations.NullMarked +package dev.openan.workflow.engine.spring; diff --git a/workflow-engine/pom.xml b/workflow-engine/pom.xml index d70d6ab..fa58fbe 100644 --- a/workflow-engine/pom.xml +++ b/workflow-engine/pom.xml @@ -140,6 +140,13 @@ ${slf4j.version} test + + + org.jspecify + jspecify + 1.0.0 + provided + diff --git a/workflow-engine/src/main/java/dev/openan/workflow/engine/client/package-info.java b/workflow-engine/src/main/java/dev/openan/workflow/engine/client/package-info.java index 20bb65d..60380af 100644 --- a/workflow-engine/src/main/java/dev/openan/workflow/engine/client/package-info.java +++ b/workflow-engine/src/main/java/dev/openan/workflow/engine/client/package-info.java @@ -11,7 +11,7 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * distributed under the License is distributed on an AS IS BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. @@ -21,4 +21,5 @@ * Protocol adaptation: transport runtimes, authentication, negotiation correlation, independent * subscriptions, and wire observability. Content generation stays with the host. */ +@org.jspecify.annotations.NullMarked package dev.openan.workflow.engine.client; From 3b8ab4bc1013f69a99677a723c91fbe94a98d705 Mon Sep 17 00:00:00 2001 From: Zhoujie628 Date: Thu, 17 Sep 2026 15:00:30 +0800 Subject: [PATCH 2/2] build: add Checkstyle, SpotBugs and JaCoCo quality gates Three static-analysis gates join Spotless in the reactor build: - Checkstyle (validate phase): naming, complexity and structural checks. Formatting stays with Spotless; thresholds calibrated to the existing codebase with a suppressions file for accepted legacy items. - SpotBugs (verify phase, threshold Medium): bug-pattern detection with a documented exclusion filter (mutable-exposure API surface, no-serialization project, demo-code items to revisit on next touch). - JaCoCo (test phase): coverage reporting per module, no threshold gate yet. Also fix two latent items the gates surfaced: expand star imports in DefaultWorkflowEngineClient, and add JSpecify @NullMarked package-info to the client and spring packages (with jspecify as provided dependency and google-java-format 1.24.0, which handles the newer JDK APIs). Signed-off-by: Zhoujie628 --- config/checkstyle/checkstyle-suppressions.xml | 22 +++++ config/checkstyle/checkstyle.xml | 82 +++++++++++++++++ config/spotbugs/spotbugs-exclude.xml | 91 +++++++++++++++++++ pom.xml | 75 +++++++++++++++ .../client/DefaultWorkflowEngineClient.java | 17 +++- 5 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 config/checkstyle/checkstyle-suppressions.xml create mode 100644 config/checkstyle/checkstyle.xml create mode 100644 config/spotbugs/spotbugs-exclude.xml diff --git a/config/checkstyle/checkstyle-suppressions.xml b/config/checkstyle/checkstyle-suppressions.xml new file mode 100644 index 0000000..c598199 --- /dev/null +++ b/config/checkstyle/checkstyle-suppressions.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..6efaaf0 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/spotbugs/spotbugs-exclude.xml b/config/spotbugs/spotbugs-exclude.xml new file mode 100644 index 0000000..e49f56a --- /dev/null +++ b/config/spotbugs/spotbugs-exclude.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index f73751d..f2e8188 100644 --- a/pom.xml +++ b/pom.xml @@ -195,6 +195,81 @@ + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.6.0 + + + com.puppycrawl.tools + checkstyle + 10.20.0 + + + + ${maven.multiModuleProjectDirectory}/config/checkstyle/checkstyle.xml + config_loc=${maven.multiModuleProjectDirectory}/config/checkstyle + false + true + true + + + + checkstyle-check + validate + + check + + + + + + + + com.github.spotbugs + spotbugs-maven-plugin + 4.8.6.4 + + Max + Medium + ${maven.multiModuleProjectDirectory}/config/spotbugs/spotbugs-exclude.xml + true + + + + spotbugs-check + verify + + check + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + jacoco-prepare-agent + + prepare-agent + + + + jacoco-report + test + + report + + + + + org.codehaus.mojo flatten-maven-plugin diff --git a/workflow-engine/src/main/java/dev/openan/workflow/engine/client/DefaultWorkflowEngineClient.java b/workflow-engine/src/main/java/dev/openan/workflow/engine/client/DefaultWorkflowEngineClient.java index 0eb90de..525f125 100644 --- a/workflow-engine/src/main/java/dev/openan/workflow/engine/client/DefaultWorkflowEngineClient.java +++ b/workflow-engine/src/main/java/dev/openan/workflow/engine/client/DefaultWorkflowEngineClient.java @@ -23,9 +23,22 @@ import dev.openan.workflow.engine.control.EventCallback; import dev.openan.workflow.engine.control.EventType; import dev.openan.workflow.engine.control.NegotiationStrategy; -import dev.openan.workflow.engine.model.*; +import dev.openan.workflow.engine.model.BusinessFailure; +import dev.openan.workflow.engine.model.MessageContent; +import dev.openan.workflow.engine.model.NegotiationReply; +import dev.openan.workflow.engine.model.NegotiationRequest; +import dev.openan.workflow.engine.model.ReceivedMessage; +import dev.openan.workflow.engine.model.SendMessageResult; +import dev.openan.workflow.engine.model.TaskRequest; import java.time.Duration; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException;