-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
HHH-16809 + HHH-18976 Avoid usage of Array.newInstance + Add JavaType#newArray #9576
Closed
Conversation
This file contains 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
…Array#newInstance
…lans It's more consistent, and happens to get rid of ArrayMutabilityPlan, which involved an unnecessary use of Array.newInstance. I've also seen claims that clone() performs better than Array.newInstance() due to not having to zero-out the allocated memory, but I doubt that's relevant here.
No functional impact, it's just less redundant.
…e type descriptors
The underlying JDBC driver only needs Object[], so there's no need to try hard to create a T[].
https://hibernate.atlassian.net/browse/HHH-16809 Note these methods only handle arrays of objects (T[], Object[]) and not arrays of primitives (e.g. int[]), but that's fine as all the replaced calls were manipulating arrays of objects. In most cases they were manipulating an array of JavaType.getJavaTypeClass(), and that class represents the generic parameter T in JavaType<T>, which can be many things but never a primitive type, since generics don't support primitive types. Co-Authored-By: Yoann Rodière <[email protected]>
…pe to getArrayClass For consistency with: 1. PrimitiveJavaType#getArrayClass 2. Array#newInstance
… to new Object[] The dynamic instantiations were originally introduced to fix the following issues: * HHH-17201 -- tested in MultiIdEntityLoadTests The corresponding tests still pass after removing these dynamic array instantiations.
Thanks for your pull request! This pull request does not follow the contribution rules. Could you have a look? ❌ All commit messages should start with a JIRA issue key matching pattern › This message was automatically generated. |
yrodiere
changed the title
HHH-16809 + HHH-18976 Add JavaType#createArray
HHH-16809 + HHH-18976 Avoid usage of Array.newInstance + Add JavaType#newArray
Jan 6, 2025
Closing in favor of the simpler #9589 . HHH-16809 may be addressed in the future too, but it's not an immediate conceern anymore. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Alternative to #9569 that also solves HHH-16809 (though that part is still WIP, see WIP commit).
Some early local testing against PostgreSQL seems to indicate it works, and doesn't rely on
Array#newInstance
anymore. Let's see what CI things about it...