Repository navigation
fix: a generic Java action's result takes the entity its type parameter is bound to - #2719
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2701 (upstream mendixlabs#1986)
What was wrong
javaActionResultTypetyped aList of Treturn as the type of the first list argument, whichever type parameter that list binds. It never read anentity <T>argument, and it did not type an object-of-T return at all. ForRetrieveFor<InputType, ResultType>(ObjectList: List of InputType, RetrieveEntity: entity <ResultType>) returns List of ResultType:List of Sales.Customer, sosum $OrderList by Amountwas refused byexecaftercheckpassed.entity <ResultType>): the result was untyped, and the aggregate was writtensum $OrderList by ;, which is CE0015 inmx check.Fix
javaActionResultType(jaDef, bound)matches the return's type parameter (ListType.TypeParameter/TypeParameterID, orTypeParameter) against the parameter that binds it:entity <T>gives its entity,List of Tits list's entity,Tits object's entity. It compares by ID when both sides carry one, else by name.javaActionArgTypes).alter's typing of a stored call reads anentity <T>binding from the stored mapping (storedEntityTypeResult).Tests
TestJavaActionResultTypeFollowsTheReturnsTypeParameter_2701covers: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 byentity <T>now writes a find by attribute. It fails withstoredEntityTypeResultstubbed.TestAlterMicroflow_FindOverUntypedListIsRefusedused exactly this call as its "untyped list". Its fixture now passesEntityType = 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:
Sales.Customer has no member "Amount"TotalAmountsum $OrderList by ;sum $OrderList by Amountmx checkDescribe → exec of all three reports
Unchanged.make ci-localpassed.Generated by Claude Code