Skip to content

@Nullable annotation is missing at ListOperations::indexOf #2488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amaembo opened this issue Jan 13, 2023 · 1 comment
Closed

@Nullable annotation is missing at ListOperations::indexOf #2488

amaembo opened this issue Jan 13, 2023 · 1 comment
Assignees
Labels
type: task A general task

Comments

@amaembo
Copy link

amaembo commented Jan 13, 2023

Methods indexOf and lastIndexOf here are documented as nullable but not annotated correspondingly.

The documentation says:

@return {@literal null} when used in pipeline / transaction or when not contained in list.

However, the methods are not annotated as @Nullable, and the package is annotated as @NonNullApi. This causes false-positive static analysis warnings. Sorry if I'm missing something.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 13, 2023
@christophstrobl christophstrobl added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 16, 2023
@christophstrobl christophstrobl self-assigned this Jan 16, 2023
@jxblum
Copy link
Contributor

jxblum commented Jan 20, 2023

For SD Redis ListOperations, corresponding to Redis List commands, the indexOf(key, value) and lastIndexOf(key, value) methods both map to the LPOS Redis command, and I can verify the documentation states that nil will be returned when no match is found.

Therefore, it is correct to annotate our API with the Spring @Nullable annotation and make the declaration consistent with our Javadoc.

@jxblum jxblum closed this as completed in b958756 Jan 20, 2023
jxblum added a commit to jxblum/spring-data-redis that referenced this issue Jan 20, 2023
jxblum added a commit to jxblum/spring-data-redis that referenced this issue Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

4 participants