Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`RedisList.reversed()` view returns an empty `range` and `trim` removes all elements

Closed Beginner friendly
#3,461 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 8 days

@mhalbritter is already working on this.

Since Oct 19, 2026.

  • #3462 by @CCCLL — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, redis, spring
Domain
backend, databases

Research direction

Start by locating ReversedRedisListView and its range and trim methods, then read the existing index-based methods to understand how the view maps indexes. Add tests for ranges and trims spanning multiple elements, including a negative end index, and verify the view follows reversed order while preserving the expected underlying list. The issue reports reproduction on Redis 8.6.2 with Lettuce and Jedis.

Written by the indexing model from the issue text.

Description

type: bug

ReversedRedisListView (returned by RedisList.reversed()) translates range and trim by swapping the two indexes:

public List<E> range(long start, long end) {
	return this.base.range(end, start);
}

public RedisList<E> trim(long start, long end) {
	this.base.trim(end, start);
	return this;
}

For a range spanning more than one element, Redis then receives a start index behind the end index, so range returns an empty list and trim removes every element:

RedisList<String> list = RedisList.create("list", template); // [1, 2, 3, 4]
RedisList<String> reversed = list.reversed();                // [4, 3, 2, 1]

reversed.range(0, 1);  // [], expected [4, 3]
reversed.range(0, -1); // [], expected [4, 3, 2, 1]
reversed.trim(0, 1);   // removes the key, expected the view to be [4, 3]

Expected: both methods apply to the elements in the order of the view, like get(int) and the other index-based methods do. Redis counts negative indexes from the tail, so the index i of the view is the index -i - 1 of the underlying list. range(start, end) can therefore be served by LRANGE key (-end - 1) (-start - 1) with the result reversed, and trim(start, end) by LTRIM key (-end - 1) (-start - 1).

Reproduced on main against Redis 8.6.2 with Lettuce and Jedis. 3.5.x, 4.0.x and 4.1.x contain the same code. I will submit a PR with a fix and tests.

Dominant language
Java
Stars
1.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from spring-projects/spring-data-redis

All issues in spring-projects/spring-data-redis

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.