GROOVY-12043: Provide curryWith helpers#2569
Open
paulk-asert wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2569 +/- ##
==================================================
- Coverage 68.1611% 68.1590% -0.0021%
- Complexity 33112 33120 +8
==================================================
Files 1508 1510 +2
Lines 126154 126199 +45
Branches 22890 22890
==================================================
+ Hits 85988 86016 +28
- Misses 32540 32554 +14
- Partials 7626 7629 +3
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds curryWith helpers for java.util.function BiPredicate/BiFunction/BiConsumer types (which lack Closure.rcurry), plus from lifters that produce hybrid SAM+Closure values usable with both SAM-accepting JDK/DGM APIs and Closure-accepting DGM APIs.
Changes:
- New
org.apache.groovy.util.LambdaswithcurryWithoverloads returning barePredicate/Function/Consumer. - New
org.apache.groovy.util.Closureswithfrom(...)lifters,curryWith(...)composing onLambdas.curryWith, and three nested hybrid classes (PredicateClosure,FunctionClosure,ConsumerClosure) extendingClosureand implementing the matching SAM. - New tests (
LambdasTest,ClosuresTest) and a new "Currying functional interfaces" section incore-closures.adoc.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/apache/groovy/util/Lambdas.java | New utility with curryWith returning bare SAMs. |
| src/main/java/org/apache/groovy/util/Closures.java | New utility with from and curryWith returning hybrid SAM+Closure values. |
| src/spec/doc/core-closures.adoc | Adds user docs for the new currying helpers. |
| src/test/groovy/org/apache/groovy/util/LambdasTest.groovy | Coverage for bare-SAM curryWith overloads including @CompileStatic. |
| src/test/groovy/org/apache/groovy/util/ClosuresTest.groovy | Coverage for from, hybrid curryWith, DGM/Stream integration, and @CompileStatic. |
✅ All tests passed ✅🏷️ Commit: 31b6dfc Learn more about TestLens at testlens.app. |
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.
No description provided.