You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple clean-up of reflection-related code: use ReflectionUtils.isEqualsMethod() / ReflectionUtils.isHashCodeMethod() / ReflectionUtils.isToStringMethod() in order to have unified approach in all pieces of code.
This is to some degree intentional since those ReflectionUtils methods implement strict signature checks (including parameter types) whereas the proxy-internal checks make simplified assumptions and just compare the method name if no same-named overloaded methods are to be expected. From that perspective, it seems sensible to retain the current simple checks in those places; I have yet to review whether the stricter checks might be applicable for certain code paths there.
Oh, I see. I can then revert illegal changes and keep at least those in ReflectionUtils as comparison of int is likely to be faster than call to Object.equals()
Damn, it seems I've force-pushed another branch into it... I'll rename PR then according to its purpose.
Here I've noticed that in numerous cases ClassUtils.toClassArray() is called with empty collection resulting in garbage Class[] allocations. This can be dodged in the similar way as we do in StringUtils.toStringArray()
stsypanov
changed the title
Use RU.isEqualsMethod() / RU.isHashCodeMethod() / RU.isToStringMethod() where appropriate
Reduce Class[] garbage when creating proxies
Mar 16, 2020
I'm applying a part of this for 5.2.5 still, namely a private EMPTY_CLASS_ARRAY constant that we're using in toClassArray, aligning it with the recent revision of StringUtils.toStringArray in the 5.2 line.
As for the code in ExtendedEntityManagerCreator, I'd rather prefer to keep it aligned with the multi-interface case below. Also, since ClassUtils.hasConstructor would require a new public method and isn't really used in a common hot code path, I'd rather keep the regular version only.
Thanks for the extensive pull request, in any case!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simple clean-up of reflection-related code: use ReflectionUtils.isEqualsMethod() / ReflectionUtils.isHashCodeMethod() / ReflectionUtils.isToStringMethod() in order to have unified approach in all pieces of code.