Skip to content

Replace @NotNull (validation) with @Nonnull for correct JSON schema generation#330

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/replace-notnull-with-nonnull
Open

Replace @NotNull (validation) with @Nonnull for correct JSON schema generation#330
Copilot wants to merge 3 commits into
mainfrom
copilot/replace-notnull-with-nonnull

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

jakarta.validation.constraints.@NotNull is not recognized by the annotation processor used for JSON schema generation. Switching to jakarta.annotation.@Nonnull ensures fields are correctly marked as required in generated schemas.

Changes

  • All domain types (commands, events, states — main modules + test-apps): replaced jakarta.validation.constraints.NotNull / org.jetbrains.annotations.NotNull imports and @NotNull usages with jakarta.annotation.Nonnull; removed duplicate imports where @Nonnull was already present
  • JsonSchemaGenerator.hasRequiredAnnotation(): added jakarta.annotation.Nonnull to the recognized annotation list so the processor emits required for annotated fields
// Before
import jakarta.validation.constraints.NotNull;

public record CreateWalletCommand(
    @AggregateIdentifier @NotNull String id,
    @NotNull String currency
) implements Command { ... }

// After
import jakarta.annotation.Nonnull;

public record CreateWalletCommand(
    @AggregateIdentifier @Nonnull String id,
    @Nonnull String currency
) implements Command { ... }

@jwijgerd jwijgerd marked this pull request as ready for review April 10, 2026 15:57
Copilot AI review requested due to automatic review settings April 10, 2026 15:57

@CommandHandler(create = true, produces = WalletCreatedEvent.class, errors = {})
public @NotNull Stream<DomainEvent> create(@NotNull CreateWalletCommand cmd, WalletStateV2 isNull) {
public @Nonnull Stream<DomainEvent> create(@Nonnull CreateWalletCommand cmd, WalletStateV2 isNull) {

@EventSourcingHandler
public @NotNull CryptoMarketState apply(@NotNull MarketOrderFilledEvent event, CryptoMarketState currentState) {
public @Nonnull CryptoMarketState apply(@Nonnull MarketOrderFilledEvent event, CryptoMarketState currentState) {

@EventSourcingHandler
public @NotNull CryptoMarketState apply(@NotNull MarketOrderPlacedEvent event, CryptoMarketState currentState) {
public @Nonnull CryptoMarketState apply(@Nonnull MarketOrderPlacedEvent event, CryptoMarketState currentState) {

@CommandHandler(create = true, produces = CryptoMarketCreatedEvent.class, errors = {})
public @NotNull Stream<DomainEvent> handle(@NotNull CreateCryptoMarketCommand command, CryptoMarketState isNull) {
public @Nonnull Stream<DomainEvent> handle(@Nonnull CreateCryptoMarketCommand command, CryptoMarketState isNull) {

@EventSourcingHandler(create = true)
public @NotNull WalletStateV2 create(@NotNull WalletCreatedEvent event, WalletStateV2 isNull) {
public @Nonnull WalletStateV2 create(@Nonnull WalletCreatedEvent event, WalletStateV2 isNull) {
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes nullability annotations across Akces domain types by replacing @NotNull annotations (Jakarta Validation / JetBrains) with jakarta.annotation.@Nonnull, and updates the EventCatalog JSON schema generator to treat @Nonnull as a “required” indicator so generated schemas correctly emit required properties.

Changes:

  • Replaced jakarta.validation.constraints.NotNull / org.jetbrains.annotations.NotNull with jakarta.annotation.Nonnull across commands/events/states (including test-apps and tests).
  • Updated JsonSchemaGenerator.hasRequiredAnnotation() to recognize jakarta.annotation.Nonnull as a required marker.
  • Updated multiple schema-related tests/fixtures to use @Nonnull instead of @NotNull.

Reviewed changes

Copilot reviewed 108 out of 108 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test-apps/crypto-trading/queries/src/main/java/org/elasticsoftware/cryptotrading/query/WalletQueryModelState.java Swap @NotNull@Nonnull on query model state components/ctors.
test-apps/crypto-trading/queries/src/main/java/org/elasticsoftware/cryptotrading/query/jdbc/CryptoMarket.java Swap @NotNull@Nonnull for Spring Data JDBC record + constructors/factory.
test-apps/crypto-trading/queries/src/main/java/org/elasticsoftware/cryptotrading/query/AccountQueryModelState.java Remove @NotNull usage in favor of @Nonnull.
test-apps/crypto-trading/commands/src/main/java/org/elasticsoftware/cryptotrading/web/dto/OrderInput.java Swap DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/commands/src/main/java/org/elasticsoftware/cryptotrading/web/dto/CreateBalanceInput.java Swap DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/commands/src/main/java/org/elasticsoftware/cryptotrading/web/dto/AccountOutput.java Swap DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/commands/src/main/java/org/elasticsoftware/cryptotrading/web/dto/AccountInput.java Swap DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/services/coinbase/Ticker.java Swap Coinbase API DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/services/coinbase/Product.java Swap Coinbase API DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/services/coinbase/Order.java Swap Coinbase API DTO field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/WalletStateV2.java Swap wallet state/component nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/WalletState.java Swap wallet state/component nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/Wallet.java Swap handler parameter/return nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/WalletDebitedEvent.java Swap event field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/WalletCreditedEvent.java Swap event field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/WalletCreatedEvent.java Swap event field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/ReservationNotFoundErrorEvent.java Swap error event field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/ReservationCancelledEvent.java Swap event field nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/InvalidCryptoCurrencyErrorEvent.java Swap error event nullability annotations to @Nonnull (keep nullable reference).
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/InvalidAmountErrorEvent.java Swap error event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/InsufficientFundsErrorEvent.java Swap error event nullability annotations to @Nonnull (keep nullable reference).
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/BalanceCreatedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/BalanceAlreadyExistsErrorEvent.java Swap error event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/events/AmountReservedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/commands/ReserveAmountCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/commands/DebitWalletCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/commands/CreditWalletCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/commands/CreateWalletCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/commands/CreateBalanceCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/wallet/commands/CancelReservationCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/OrderProcessManagerState.java Swap process-manager state nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/UserOrderProcessesCreatedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/SellOrderRejectedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/SellOrderPlacedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/SellOrderFilledEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/SellOrderCreatedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/BuyOrderRejectedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/BuyOrderPlacedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/BuyOrderFilledEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/events/BuyOrderCreatedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/commands/RejectOrderCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/commands/PlaceSellOrderCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/commands/PlaceBuyOrderCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/commands/FillSellOrderCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/orders/commands/FillBuyOrderCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/events/MarketOrderRejectedErrorEvent.java Swap error event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/events/MarketOrderPlacedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/events/MarketOrderFilledEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/events/CryptoMarketCreatedEvent.java Swap event nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/CryptoMarketState.java Swap state nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/CryptoMarket.java Swap handler parameter/return nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/commands/PlaceMarketOrderCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/cryptomarket/commands/CreateCryptoMarketCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/account/events/AccountCreatedEvent.java Swap event nullability annotations to @Nonnull (including PII fields).
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/account/commands/CreateAccountCommand.java Swap command nullability annotations to @Nonnull.
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/account/AccountState.java Swap state nullability annotations to @Nonnull (including PII fields).
test-apps/crypto-trading/aggregates/src/main/java/org/elasticsoftware/cryptotrading/aggregates/account/Account.java Swap event-sourcing handler nullability annotations to @Nonnull.
main/shared/src/main/java/org/elasticsoftware/akces/errors/CommandExecutionErrorEvent.java Swap error event nullability annotations to @Nonnull.
main/shared/src/main/java/org/elasticsoftware/akces/errors/AggregateNotFoundErrorEvent.java Swap error event nullability annotations to @Nonnull.
main/shared/src/main/java/org/elasticsoftware/akces/errors/AggregateAlreadyExistsErrorEvent.java Swap error event nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/schemas/NotCompatibleAccountCreatedEventV4.java Swap test schema fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/schemas/JsonSchemaTests.java Replace JetBrains @NotNull with jakarta.annotation.@Nonnull in tests.
main/runtime/src/test/java/org/elasticsoftware/akcestest/schemas/CreditWalletCommand.java Swap test schema fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/schemas/AccountCreatedEventV3.java Swap test schema fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/schemas/AccountCreatedEventV2.java Swap test schema fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/schemas/AccountCreatedEvent.java Swap test schema fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/old/WalletCreditedEvent.java Swap legacy test fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/old/CreateWalletCommand.java Swap legacy test fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/old/BuyOrderPlacedEvent.java Swap legacy test fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/old/BalanceCreatedEvent.java Swap legacy test fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/WalletStateV2.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/WalletState.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/WalletCreditedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/WalletCreatedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/Wallet.java Swap runtime test aggregate fixture handler annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/ReserveAmountCommand.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/InvalidCurrencyErrorEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/InvalidAmountErrorEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/InsufficientFundsErrorEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/ExternalAccountCreatedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/CreditWalletCommand.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/CreateWalletCommand.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/CreateBalanceCommand.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/BalanceCreatedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/BalanceAlreadyExistsErrorEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/wallet/AmountReservedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/orders/UserOrderProcessesCreatedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/orders/PlaceBuyOrderCommand.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/orders/OrderProcessManagerState.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/orders/BuyOrderRejectedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/orders/BuyOrderPlacedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/orders/BuyOrderCreatedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/account/PreviousAccountState.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/account/CreateAccountCommand.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/account/AccountState.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/account/AccountCreatedEventV2.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/account/AccountCreatedEvent.java Swap runtime test aggregate fixture nullability annotations to @Nonnull.
main/runtime/src/test/java/org/elasticsoftware/akcestest/aggregate/account/Account.java Swap runtime test aggregate fixture handler annotations to @Nonnull.
main/query-support/src/test/java/org/elasticsoftware/akces/query/models/wallet/WalletQueryModelState.java Swap test query-model state nullability annotations to @Nonnull.
main/query-support/src/test/java/org/elasticsoftware/akces/query/models/account/AccountQueryModelState.java Swap test query-model state method return annotation to @Nonnull.
main/eventcatalog/src/test/java/org/elasticsoftware/akces/eventcatalog/EventCatalogProcessorTest.java Update inlined compilation sources to use @Nonnull.
main/eventcatalog/src/main/java/org/elasticsoftware/akces/eventcatalog/JsonSchemaGenerator.java Treat jakarta.annotation.Nonnull as “required” for schema generation.
main/client/src/test/java/org/elasticsoftware/akces/client/events/AccountCreatedEvent.java Swap test event fixture nullability annotations to @Nonnull.
main/client/src/test/java/org/elasticsoftware/akces/client/commands/UnroutableCommand.java Swap test command fixture getAggregateId() return annotation to @Nonnull.
main/client/src/test/java/org/elasticsoftware/akces/client/commands/InvalidCommand.java Swap test command fixture getAggregateId() return annotation to @Nonnull.
main/client/src/test/java/org/elasticsoftware/akces/client/commands/CreateAccountCommand.java Swap test command fixture nullability annotations to @Nonnull.
main/agentic/src/main/java/org/elasticsoftware/akces/agentic/events/AgentTaskAssignedEvent.java Swap agentic event nullability annotations to @Nonnull for required fields.
main/agentic/src/main/java/org/elasticsoftware/akces/agentic/commands/AssignTaskCommand.java Swap agentic command nullability annotations to @Nonnull for required fields.

Comment on lines 89 to 92
@EventSourcingHandler(create = true)
@NotNull
public AccountState create(@NotNull AccountCreatedEventV2 event, AccountState isNull) {
@Nonnull
public AccountState create(@Nonnull AccountCreatedEventV2 event, AccountState isNull) {
return new AccountState(event.userId(), event.country(), event.firstName(), event.lastName(), event.email());
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The embedded Java source string uses @Nonnull (e.g., on the event-sourcing handler method/parameter) but the source snippet itself does not import jakarta.annotation.Nonnull (nor use a fully-qualified name). This will cause the compile-testing compilation in this test to fail; add the import to each affected source snippet (Account/AccountState/CreateAccountCommand/AccountCreatedEvent/etc.) or fully-qualify the annotation in the snippet.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
public @NotNull WalletStateV2 create(@NotNull WalletCreatedEvent event, WalletStateV2 isNull) {
public @Nonnull WalletStateV2 create(@Nonnull WalletCreatedEvent event, WalletStateV2 isNull) {
// `isNull` is part of the framework handler signature for create handlers.
WalletStateV2 ignored = isNull;
@EventHandler(create = true, produces = WalletCreatedEvent.class, errors = {})
public @NotNull Stream<DomainEvent> create(@NotNull AccountCreatedEvent event, WalletStateV2 isNull) {
@SuppressWarnings("unused")
public @Nonnull Stream<DomainEvent> create(@Nonnull AccountCreatedEvent event, WalletStateV2 isNull) {

@EventSourcingHandler(create = true)
public @NotNull CryptoMarketState apply(@NotNull CryptoMarketCreatedEvent event, CryptoMarketState isNull) {
public @Nonnull CryptoMarketState apply(@Nonnull CryptoMarketCreatedEvent event, CryptoMarketState _unusedState) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants