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
Optimize memory consumption in junit.framework.Assert #820
Conversation
@@ -117,7 +117,7 @@ static public void assertEquals(String message, double expected, double actual, | |||
return; | |||
} | |||
if (!(Math.abs(expected - actual) <= delta)) { | |||
failNotEquals(message, new Double(expected), new Double(actual)); | |||
failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually isn't an optimization; Double.valueOf(double d)
just calls 'new Double(d)'
Let's just remove this change. Since this class is deprecated, I want to minimize changes to it wherever possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely agree, I've just repeat the same approach, that was used in new Assert class to work with Float and Double types. It is not a problem to revert it. :)
Thanks for the contribution. I was almost tempted to close this without pulling it; part of the benefit of deprecating a class is that we can reduce the maintenance time by avoiding unnecessary changes to the class. But this looks really safe (famous last words :-) |
Yes, it should be safe. Will it be accepted if I revert changes with Float and Double types? |
I'd be happy to pull if you revert the changes with Float and Double |
Ok, some changes were reverted |
Optimize memory consumption in junit.framework.Assert
Thanks! |
Thank you for merge! |
New class org.junit.Assert already contains optimized assert methods (with Long.valueOf etc), for example:
Old (deprecated) version of this class (junit.framework.Assert) contains not-optimized methods, for example:
Whole class is deprecated, but I sure that this methods are still used in many projects, so I suggest to optimize them, until they are presented in JUnit.