You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2026/05/26 08:52:08 UTC

(causeway) branch main updated: CAUSEWAY-2297: reflective final field mutation will be invalid

This is an automated email from the ASF dual-hosted git repository.

andi-huber pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/main by this push:
     new d20ba91b4a9 CAUSEWAY-2297: reflective final field mutation will be invalid
d20ba91b4a9 is described below

commit d20ba91b4a989fcefbc218b97bc806f6e187aea9
Author: andi-huber <ah...@apache.org>
AuthorDate: Tue May 26 10:52:00 2026 +0200

    CAUSEWAY-2297: reflective final field mutation will be invalid
    
    in future JVMs
---
 .../command/CommandExecutorServiceDefault.java     | 27 +++++++++-------------
 .../applib/restapi/OutboxRestApi.java              | 12 +++-------
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java
index b54e3155b53..fb66f5b1b16 100644
--- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java
@@ -24,7 +24,6 @@
 import java.util.stream.Stream;
 
 import jakarta.annotation.Priority;
-import jakarta.inject.Inject;
 import jakarta.inject.Named;
 import jakarta.inject.Provider;
 
@@ -67,8 +66,6 @@
 import org.apache.causeway.schema.cmd.v2.PropertyDto;
 import org.apache.causeway.schema.common.v2.InteractionType;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -81,23 +78,21 @@
 @Priority(PriorityPrecedence.MIDPOINT)
 @Qualifier("Default")
 @Slf4j
-@RequiredArgsConstructor
-public class CommandExecutorServiceDefault implements CommandExecutorService {
+public record CommandExecutorServiceDefault(
+        BookmarkService bookmarkService,
+        SudoService sudoService,
+        ClockService clockService,
+        TransactionService transactionService,
+        InteractionProvider interactionProvider,
+        SchemaValueMarshaller valueMarshaller,
+        MetaModelService metaModelService,
+        Provider<CommandPublisher> commandPublisherProvider,
+        SpecificationLoader specificationLoader
+        ) implements CommandExecutorService {
 
     private static final Pattern ID_PARSER =
             Pattern.compile("(?<className>[^#]+)#?(?<localId>[^(]+)(?<args>[(][^)]*[)])?");
 
-    @Inject final BookmarkService bookmarkService;
-    @Inject final SudoService sudoService;
-    @Inject final ClockService clockService;
-    @Inject final TransactionService transactionService;
-    @Inject final InteractionProvider interactionProvider;
-    @Inject final SchemaValueMarshaller valueMarshaller;
-    @Inject final MetaModelService metaModelService;
-    @Inject Provider<CommandPublisher> commandPublisherProvider;
-
-    @Inject @Getter final SpecificationLoader specificationLoader;
-
     @Override
     public Try<Bookmark> executeCommand(final Command command) {
         return executeCommand(InteractionContextPolicy.NO_SWITCH, command);
diff --git a/extensions/core/executionoutbox/applib/src/main/java/org/apache/causeway/extensions/executionoutbox/applib/restapi/OutboxRestApi.java b/extensions/core/executionoutbox/applib/src/main/java/org/apache/causeway/extensions/executionoutbox/applib/restapi/OutboxRestApi.java
index db6a4839572..ce51392c19e 100644
--- a/extensions/core/executionoutbox/applib/src/main/java/org/apache/causeway/extensions/executionoutbox/applib/restapi/OutboxRestApi.java
+++ b/extensions/core/executionoutbox/applib/src/main/java/org/apache/causeway/extensions/executionoutbox/applib/restapi/OutboxRestApi.java
@@ -21,7 +21,6 @@
 import java.util.List;
 import java.util.UUID;
 
-import jakarta.inject.Inject;
 import jakarta.inject.Named;
 
 import org.apache.causeway.applib.annotation.Action;
@@ -35,8 +34,6 @@
 import org.apache.causeway.extensions.executionoutbox.applib.dom.ExecutionOutboxEntryRepository;
 import org.apache.causeway.extensions.executionoutbox.applib.spiimpl.ContentMappingServiceForOutboxEvents;
 
-import lombok.RequiredArgsConstructor;
-
 /**
  * Provides a server-side REST API for the <i>outbox rest client</i> to call, to first obtain {@link #pending() pending}
  * {@link ExecutionOutboxEntry outbox entries} to be processed, and then later to request them to be
@@ -46,13 +43,12 @@
  */
 @Named(OutboxRestApi.LOGICAL_TYPE_NAME)
 @DomainService
-@RequiredArgsConstructor
-public class OutboxRestApi  {
+public record OutboxRestApi(
+        FactoryService factoryService,
+        ExecutionOutboxEntryRepository executionOutboxEntryRepository)  {
 
     static final String LOGICAL_TYPE_NAME = CausewayModuleExtExecutionOutboxApplib.NAMESPACE + ".OutboxRestApi";
 
-    final @Inject ExecutionOutboxEntryRepository executionOutboxEntryRepository;
-
     /**
      * This action is intended to be invoked with <code>Accept</code> header set to
      * <code>application/xml;profile=urn:org.restfulobjects:repr-types/action-result;x-ro-domain-type=org.apache.causeway.schema.ixn.v2.InteractionsDto</code>
@@ -97,6 +93,4 @@ public void deleteMany(final String interactionsDtoXml) {
                 });
     }
 
-    @Inject FactoryService factoryService;
-
 }