Closed tjpalmer closed 6 months ago
I think the easiest solution might be always to pass as method references. Like instead of this:
IntStringInt fn__457 = (k__35, v__36) -> k__35;
Core.mappedToListWith(messages__14, fn__457);
Say this:
IntStringInt fn__457 = (k__35, v__36) -> k__35;
Core.mappedToListWith(messages__14, fn__457::apply);
Simplest is to do that in all cases. Next simplest is in all cases when calling methods (including property assignment) outside the current library.
This definitely applies some to use of temper-core, but I think it applies elsewhere. We need to use the SAM types from the library that consumes the SAM object rather than local SAM types. This matters especially for multi-parameter function types, since
java.util.function
often helps less at 2+ parameters. For example we have this function in Core.java:But we might try to use it like this in generated code: