Skip to content

fix: a generic Java action's result takes the entity its type parameter is bound to - #2719

Merged
ako merged 1 commit into
mainfrom
claude/issue-triage-prioritization-24rqgv
Dec 1, 2026
Merged

ako merged 1 commit into
mainfrom
claude/issue-triage-prioritization-24rqgv

Conversation

@ako

@ako ako commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Closes #2701 (upstream mendixlabs#1986)

What was wrong

javaActionResultType typed a List of T return as the type of the first list argument, whichever type parameter that list binds. It never read an entity <T> argument, and it did not type an object-of-T return at all. For RetrieveFor<InputType, ResultType>(ObjectList: List of InputType, RetrieveEntity: entity <ResultType>) returns List of ResultType:

  • A / B (two type parameters): the result was typed List of Sales.Customer, so sum $OrderList by Amount was refused by exec after check passed.
  • C (only entity <ResultType>): the result was untyped, and the aggregate was written sum $OrderList by ;, which is CE0015 in mx check.

Fix

  • javaActionResultType(jaDef, bound) matches the return's type parameter (ListType.TypeParameter/TypeParameterID, or TypeParameter) against the parameter that binds it: entity <T> gives its entity, List of T its list's entity, T its object's entity. It compares by ID when both sides carry one, else by name.
  • The builder passes each argument's bound type (javaActionArgTypes).
  • The first-list fallback is kept only for a definition whose type parameter is unnamed, or that was read without its parameters.
  • alter's typing of a stored call reads an entity <T> binding from the stored mapping (storedEntityTypeResult).

Tests

  • TestJavaActionResultTypeFollowsTheReturnsTypeParameter_2701 covers:

    • cases A and C;
    • an object-of-T return;
    • the control, where the list argument does bind the return's T.
      With the matching stubbed out, A, C and object-of-T fail and the control passes.
  • TestAlterMicroflow_FindOverEntityTypeBoundListIsByAttribute: an alter over a stored call bound by entity <T> now writes a find by attribute. It fails with storedEntityTypeResult stubbed.

  • TestAlterMicroflow_FindOverUntypedListIsRefused used exactly this call as its "untyped list". Its fixture now passes EntityType = empty, which keeps the list genuinely untyped and keeps the test's intent.

  • Live, with the reporter's full script on mxbuild 11.12.6:

    old build fixed build
    A refused: Sales.Customer has no member "Amount" created
    B refused: no member TotalAmount created
    C sum $OrderList by ; sum $OrderList by Amount
    mx check CE0015 0 errors

    Describe → exec of all three reports Unchanged.

  • make ci-local passed.


Generated by Claude Code

…er is bound to

A `List of T` return was typed as the first list argument's type, whichever
type parameter that list binds, and an `entity <T>` argument was never read.
RetrieveFor<InputType, ResultType>(ObjectList: List of InputType,
RetrieveEntity: entity <ResultType>) returns List of ResultType was typed as
the input list, so `sum $Result by Amount` was refused after check passed;
with only entity <T> the result was untyped and the aggregate was written
`sum $Result by ;` (CE0015). The return's type parameter is now matched to
the parameter that binds it (entity <T>, List of T or T), in the full build
and in alter's typing of a stored call.

Closes #2701

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011oK82qrr1WnXxq1eRn7qRJ
@ako
ako merged commit c69da6c into main Dec 1, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants