Skip to content

Use Math.min() in ExponentialBackOff #25381

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
wants to merge 1 commit into from
Closed

Use Math.min() in ExponentialBackOff #25381

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 12, 2020

Reports cases where the minimum or the maximum of two numbers can be calculated by means of Math.max() or Math.min() instead of doing it manually.

…calculated by means of Math.max() or Math.min() instead of doing it manually.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 12, 2020
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Jul 12, 2020
@sbrannen sbrannen requested a review from jhoeller July 12, 2020 13:08
@@ -354,7 +354,7 @@ public ByteVector putByteArray(
private void enlarge(final int size) {
int doubleCapacity = 2 * data.length;
int minimalCapacity = length + size;
byte[] newData = new byte[doubleCapacity > minimalCapacity ? doubleCapacity : minimalCapacity];
byte[] newData = new byte[Math.max(doubleCapacity, minimalCapacity)];
Copy link
Member

Choose a reason for hiding this comment

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

Please refrain from modifying classes under org.springframework.asm, org.springframework.cglib, and org.springframework.objenesis. Those include repackaged forks of the third-party libraries ASM, CGLIB, and Objenesis. Any refactoring to those classes should take place upstream in the originating repository. The Spring Framework will then pick up the changes when syncing with official updates of the forked third-party libraries.


Note, however, that there is no need to update this PR. I'll simply revert that before merging.

@sbrannen sbrannen removed the request for review from jhoeller July 13, 2020 09:47
@sbrannen sbrannen removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 13, 2020
@sbrannen sbrannen changed the title Manual min/max calculation Use Math.min() in ExponentialBackOff Jul 13, 2020
@sbrannen sbrannen closed this in 490bdd1 Jul 13, 2020
@sbrannen
Copy link
Member

This has been revised and merged into master in 490bdd1.

Thanks

@sbrannen sbrannen added this to the 5.3 M2 milestone Jul 13, 2020
@sbrannen sbrannen self-assigned this Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants