Skip to content

Commit 4ca08a8

Browse files
committed
fix: Add nooargs constructors so we work in Jakarta
1 parent 20361c7 commit 4ca08a8

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed

extras/queue-manager-replicated/core/src/main/java/io/a2a/extras/queuemanager/replicated/core/ReplicatedQueueManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ public class ReplicatedQueueManager implements QueueManager {
3030

3131
private TaskStateProvider taskStateProvider;
3232

33+
/**
34+
* No-args constructor for CDI proxy creation.
35+
*/
36+
@SuppressWarnings("NullAway")
37+
protected ReplicatedQueueManager() {
38+
// For CDI proxy creation
39+
this.delegate = null;
40+
this.replicationStrategy = null;
41+
this.taskStateProvider = null;
42+
}
43+
3344
@Inject
3445
public ReplicatedQueueManager(ReplicationStrategy replicationStrategy, TaskStateProvider taskStateProvider) {
3546
this.replicationStrategy = replicationStrategy;

server-common/src/main/java/io/a2a/server/events/InMemoryQueueManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ public class InMemoryQueueManager implements QueueManager {
1919
private final EventQueueFactory factory;
2020
private final TaskStateProvider taskStateProvider;
2121

22+
/**
23+
* No-args constructor for CDI proxy creation.
24+
*/
25+
@SuppressWarnings("NullAway")
26+
protected InMemoryQueueManager() {
27+
// For CDI proxy creation
28+
this.factory = null;
29+
this.taskStateProvider = null;
30+
}
31+
2232
@Inject
2333
public InMemoryQueueManager(TaskStateProvider taskStateProvider) {
2434
this.factory = new DefaultEventQueueFactory();

server-common/src/main/java/io/a2a/server/requesthandlers/DefaultRequestHandler.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,23 @@ public class DefaultRequestHandler implements RequestHandler {
220220

221221
private final Executor executor;
222222

223+
/**
224+
* No-args constructor for CDI proxy creation.
225+
* CDI requires a non-private constructor to create proxies for @ApplicationScoped beans.
226+
* All fields are initialized by the @Inject constructor during actual bean creation.
227+
*/
228+
@SuppressWarnings("NullAway")
229+
protected DefaultRequestHandler() {
230+
// For CDI proxy creation
231+
this.agentExecutor = null;
232+
this.taskStore = null;
233+
this.queueManager = null;
234+
this.pushConfigStore = null;
235+
this.pushSender = null;
236+
this.requestContextBuilder = null;
237+
this.executor = null;
238+
}
239+
223240
@Inject
224241
public DefaultRequestHandler(AgentExecutor agentExecutor, TaskStore taskStore,
225242
QueueManager queueManager, PushNotificationConfigStore pushConfigStore,

server-common/src/main/java/io/a2a/server/tasks/BasePushNotificationSender.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ public class BasePushNotificationSender implements PushNotificationSender {
3030
private final A2AHttpClient httpClient;
3131
private final PushNotificationConfigStore configStore;
3232

33+
/**
34+
* No-args constructor for CDI proxy creation.
35+
*/
36+
@SuppressWarnings("NullAway")
37+
protected BasePushNotificationSender() {
38+
// For CDI proxy creation
39+
this.httpClient = null;
40+
this.configStore = null;
41+
}
42+
3343
@Inject
3444
public BasePushNotificationSender(PushNotificationConfigStore configStore) {
3545
this.httpClient = new JdkA2AHttpClient();

transport/jsonrpc/src/main/java/io/a2a/transport/jsonrpc/handler/JSONRPCHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ public class JSONRPCHandler {
6565
private RequestHandler requestHandler;
6666
private final Executor executor;
6767

68+
@SuppressWarnings("NullAway")
69+
protected JSONRPCHandler() {
70+
// For CDI proxy creation
71+
this.agentCard = null;
72+
this.extendedAgentCard = null;
73+
this.requestHandler = null;
74+
this.executor = null;
75+
}
76+
6877
@Inject
6978
public JSONRPCHandler(@PublicAgentCard AgentCard agentCard, @Nullable @ExtendedAgentCard Instance<AgentCard> extendedAgentCard,
7079
RequestHandler requestHandler, @Internal Executor executor) {

0 commit comments

Comments
 (0)