Java Interop - Typed Primitive Arrays passed as Java Args are always `Object[]`
Description
The following code, used in the the cborm module passes in an array of the org.hibernate.type.Type class:
The usage of an argument for the method signature: sqlRestriction(java.lang.String sql, java.lang.Object[] values, Type[] types)
Results in the error:
Activity
Jon ClausenMarch 26, 2025 at 5:06 PM
OK. Created for this. Will mark the initial issue as resolved.
Brad WoodMarch 26, 2025 at 4:59 PM
I think this calls for a new ticket. The second issue I fixed was already a separate bug from the original report, but I shoe-horned it into the same ticket. This 3rd error may also be related, but it’s also something different than the original report.
Jon ClausenMarch 26, 2025 at 4:38 PM
Edited
OK. I pushed up this commit with a disabled test, which reproduces the array element type mismatch. The error, as far as I can tell, seems to be triggered when filling the array with new Java classes that are not known classes to BL. When I used Key[] as the third argument to test@TestTypedArray there were no problems. It was only when I created TestTypedArraySubtype and used that the errors started to occur.
Jon ClausenMarch 26, 2025 at 3:46 PM
Edited
Actually, no. I take it back. We are still getting the java.lang.IllegalArgumentException: array element type mismatch error:
Jon ClausenMarch 26, 2025 at 3:44 PM
Edited
I can confirm that this resolves the issue with cborm
Fixed
Pinned fields
Click on the next to a field label to start pinning.
The following code, used in the the cborm module passes in an array of the
org.hibernate.type.Type
class:The usage of an argument for the method signature:
sqlRestriction(java.lang.String sql, java.lang.Object[] values, Type[] types)
Results in the error: