-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
clean up a bunch of unchecked casts using Class.cast() #11402
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
Conversation
|
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. |
| final SharedSessionContractImplementor session) throws SQLException { | ||
| //noinspection unchecked | ||
| nullSafeSet( st, (T) value, index, (WrapperOptions) session ); | ||
| final SharedSessionContractImplementor session) |
Check notice
Code scanning / CodeQL
Confusing overloading of methods Note
nullSafeSet
| } | ||
| if ( Integer.class.isAssignableFrom( type ) ) { | ||
| return (X) (Integer) Integer.parseInt( value ); | ||
| return type.cast( Integer.parseInt( value ) ); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException Note
| } | ||
| if ( Long.class.isAssignableFrom( type ) ) { | ||
| return (X) (Long) Long.parseLong( value ); | ||
| return type.cast( Long.parseLong( value ) ); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException Note
I don't know why we even need to be doing this. We deprecated that stuff. But we have one single test which is relying on this, so perhaps users are using it too.
and fix unchecked casts in the impl
this change exposed multiple bugs! 1. generic attributes declared by a mapped superclass where not being handled properly in HQL path expressions 2. getSubTypes() on EntityTypeImpl was broken (due, again, to use of unchecked cast!) causing problems in HQL
[Please describe here what your change is about]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.