Skip to content

Fix progress calculation using proper Integer unboxing method #44718

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

Conversation

KmYgJn
Copy link
Contributor

@KmYgJn KmYgJn commented Mar 14, 2025

Description

This PR fixes the Integer conversion in the getProgress() method by replacing Integer::valueOf with Integer::intValue. The original code incorrectly used valueOf which is meant for converting other types to Integer objects, while intValue() is the correct method for unboxing Integer objects to primitive int values.

Changes

  • Modified getProgress() method in the progress calculation logic
  • Replaced Integer::valueOf with Integer::intValue for proper unboxing
  • Improved semantic clarity of the code without affecting functionality

Reasoning

progressByStatus.values() returns a collection of Integer objects. When processing these values with mapToInt(), we need to extract the primitive int value from each Integer object. The valueOf() method is meant for creating Integer objects from other types (like String), while intValue() is designed for extracting the primitive value from an Integer object.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 14, 2025
@philwebb philwebb added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 14, 2025
@philwebb philwebb added this to the 3.3.x milestone Mar 14, 2025
@mhalbritter mhalbritter self-assigned this Mar 17, 2025
mhalbritter pushed a commit that referenced this pull request Mar 17, 2025
@mhalbritter
Copy link
Contributor

Thank you very much and congratulations on your first contribution 🎉!

@mhalbritter mhalbritter modified the milestones: 3.3.x, 3.3.10 Mar 17, 2025
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

Successfully merging this pull request may close these issues.

4 participants