Skip to content

[JVM] Unbox lambda invocation arguments before implementation dispatch - #606

Open
CaelmBleidd wants to merge 1 commit into
mainfrom
caelmbleidd/fix-jvm-lambda-argument-adaptation
Open

CaelmBleidd wants to merge 1 commit into
mainfrom
caelmbleidd/fix-jvm-lambda-argument-adaptation

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

A method reference such as Predicate<Integer> p = Character::isWhitespace currently passes an object reference directly into the primitive int implementation parameter. Real WordUtils analysis aborts with a register sort mismatch. Generic unboxing followed by widening also needs the instantiated method type, distinct from the erased SAM signature.

Dispatch using the erased signature and adapt invocation arguments using the instantiated signature before entering the implementation. Primitive wrapper unboxing preserves null and class-cast checks and uses the existing primitive conversion operators. The adaptation runs in its own machine step after receiver dispatch, so its exception forks belong to the selected state. Ordinary method/model dispatch remains in the existing concrete-call path.

Depends on JacoDB#449, pinned to 1822dea851: its typed lambda builder previously exchanged erased and instantiated method types. There is no guessed wrapper or exception-to-fresh fallback.

Validation: the ordinary Java Character::isWhitespace source reproduces the same sort mismatch before the change. All 4 focused regressions pass against the exact JacoDB source composite: original reproduction, nullable argument/NPE, unboxing then int -> long widening, and a primitive SAM control. No full suite was run.

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.

1 participant