Skip to content

GROOVY-11653: Create DGM#sort(List) and AGM#sort(T[]) variants that t…#2213

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy11653
May 7, 2025
Merged

GROOVY-11653: Create DGM#sort(List) and AGM#sort(T[]) variants that t…#2213
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy11653

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

…ake an IntRange

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2025

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

Project coverage is 68.9837%. Comparing base (0c48fa2) to head (b86ef54).
Report is 67 commits behind head on master.

Files with missing lines Patch % Lines
...rg/codehaus/groovy/runtime/ArrayGroovyMethods.java 62.5000% 1 Missing and 2 partials ⚠️
.../codehaus/groovy/runtime/DefaultGroovyMethods.java 93.3333% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2213        +/-   ##
==================================================
+ Coverage     68.9801%   68.9837%   +0.0036%     
- Complexity      29625      29632         +7     
==================================================
  Files            1423       1423                
  Lines          114217     114240        +23     
  Branches        19818      19823         +5     
==================================================
+ Hits            78787      78807        +20     
  Misses          28802      28802                
- Partials         6628       6631         +3     
Files with missing lines Coverage Δ
.../codehaus/groovy/runtime/DefaultGroovyMethods.java 74.5272% <93.3333%> (+0.0837%) ⬆️
...rg/codehaus/groovy/runtime/ArrayGroovyMethods.java 88.6247% <62.5000%> (-0.1350%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daniellansun
Copy link
Copy Markdown
Contributor

+1

@daniellansun daniellansun requested a review from Copilot May 6, 2025 13:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds new sort variants that allow sorting within a specific index range for both Lists and arrays, using a Closure to determine the ordering. Key changes include updated documentation on sort behavior, added overloads for sort methods that accept an IntRange, and the introduction of a toSorted method for Lists with index range support.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java Adds subrange sort methods for List, with both in-place mutation and non-mutating variants.
src/main/java/org/codehaus/groovy/runtime/ArrayGroovyMethods.java Adds subrange sort methods for arrays, supporting both in-place and non-mutating operations.
Comments suppressed due to low confidence (1)

src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java:13491

  • [nitpick] Consider updating only the sorted subrange by using self.subList(info.from, info.to) to replace the elements, which may improve clarity and focus the mutation on just the intended range.
for (T e : a) { i.next(); i.set(e); }

@paulk-asert paulk-asert merged commit d86c0d3 into apache:master May 7, 2025
21 checks passed
@paulk-asert paulk-asert deleted the groovy11653 branch May 7, 2025 22:16
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.

4 participants