> *Some final observations: This wasn't related to using kotlin, or to the
array type used in PostgreSQL. The main thing here was really the fact that
a user-defined type extending List was used with a custom converter.*
Yes, I actually wrote that in the second message of this thread:
*> I have some more insight.*
*>*
*>The exception is thrown here:*
*>*
*>if (value instanceof Collection && List.class.isAssignableFrom(mType))
{> Class componentType = (Class) ((ParameterizedType)
member.getGenericType()).getActualTypeArguments()[0];>
member.set(result, Convert.convert((Collection) value, componentType));>}>*
*>in DefaultRecordMapper.java.*
*>*
*> member is of an interface type which also implements a List
type. member.getGenericType() returns the non-generic interface type which
has no actual type arguments, and this causes the exception.*
I should have used more words. Sorry.
Thanks for fixing the bug.
Maurizio
On Wednesday, 11 November 2020 at 11:45:01 UTC+1 [email protected] wrote:
> So, https://github.com/jOOQ/jOOQ/issues/10910 will be fixed in 3.15.0 and
> 3.14.4. Thanks again for reporting it!
>
> Some final observations: This wasn't related to using kotlin, or to the
> array type used in PostgreSQL. The main thing here was really the fact that
> a user-defined type extending List was used with a custom converter.
>
> The reason why I couldn't reproduce the issue was that (obviously in
> hindsight, but I overlooked the detail because the emails here didn't
> include an insert statement), there was no data in the table, so the
> mapping logic was never invoked... A great example why MCVE's are so
> useful, because of the C (as in "complete") :)
>
> Cheers,
> Lukas
>
>
> On Wednesday, November 11, 2020 at 10:51:55 AM UTC+1 Lukas Eder wrote:
>
>> ... directly on that github issue, I meant
>>
>> On Wed, Nov 11, 2020 at 10:51 AM Lukas Eder <[email protected]> wrote:
>>
>>> OK, so I could manage to reproduce the issue with the updated MCVE:
>>> https://github.com/lukaseder/jOOQ-mcve/tree/1FOcoG5G9BU
>>>
>>> I got:
>>>
>>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.008
>>> sec <<< FAILURE!
>>> mcveTest(org.jooq.mcve.test.kotlin.KotlinTest) Time elapsed: 0.95 sec
>>> <<< ERROR!
>>> org.jooq.exception.MappingException: An error ocurred when mapping
>>> record to class org.jooq.mcve.kotlin.tables.pojos.TestTable_1
>>> at
>>> org.jooq.impl.DefaultRecordMapper$MutablePOJOMapper.map(DefaultRecordMapper.java:877)
>>> at
>>> org.jooq.impl.DefaultRecordMapper.map(DefaultRecordMapper.java:543)
>>> at org.jooq.impl.ResultImpl.into(ResultImpl.java:1285)
>>> at
>>> org.jooq.impl.AbstractResultQuery.fetchInto(AbstractResultQuery.java:1545)
>>> at org.jooq.impl.SelectImpl.fetchInto(SelectImpl.java:3936)
>>> at
>>> org.jooq.mcve.test.kotlin.KotlinTest.mcveTest(KotlinTest.kt:20)
>>> Caused by: java.lang.ClassCastException: class java.lang.Class cannot be
>>> cast to class java.lang.reflect.ParameterizedType (java.lang.Class and
>>> java.lang.reflect.ParameterizedType are in module java.base of loader
>>> 'bootstrap')
>>> at
>>> org.jooq.impl.DefaultRecordMapper$MutablePOJOMapper.map(DefaultRecordMapper.java:909)
>>> at
>>> org.jooq.impl.DefaultRecordMapper$MutablePOJOMapper.map(DefaultRecordMapper.java:829)
>>> ... 39 more
>>>
>>> I've created https://github.com/jOOQ/jOOQ/issues/10910 for this. I'll
>>> make further comments directly on that list.
>>>
>>> On Wed, Nov 11, 2020 at 9:28 AM Lukas Eder <[email protected]> wrote:
>>>
>>>> On Wed, Nov 11, 2020 at 8:28 AM Maurizio <[email protected]> wrote:
>>>>
>>>>> I'm sorry you could not reproduce the bug. I thought this was easy.
>>>>
>>>>
>>>> It probably is, but after several emails, I still couldn't get it to
>>>> reproduce, while my queue is also quite full at the moment. The Kotlin
>>>> integration is quite new and there are a few more obvious and pressing
>>>> bugs
>>>> than this one. I still want to try to reproduce and fix it, but I need to
>>>> be able to reproduce it first.
>>>>
>>>>
>>>>> As promised, I'll try and package the code as a fork of the
>>>>> *jOOQ-mcve* repository. I delayed because I'm not familiar with
>>>>> Maven, and I'm a bit cognitively overwhelmed, currently, but I should be
>>>>> able to do it.
>>>>>
>>>>
>>>> So, it's a stalemate :) The template allows for immediate reproduction,
>>>> so from experience, I tend to think it's worth it. This is already the
>>>> 12th
>>>> email in this thread (and there are other threads). When bugs reported
>>>> through the template usually require a single email or github issue. I
>>>> believe that while it may take some time to get into, it does save time on
>>>> both sides (and it's also often helped find out user errors, which aren't
>>>> actual bugs, which I don't think is the case in your case).
>>>>
>>>> Anyway, how can we have improved the template for you? One thing I will
>>>> do immediately is configure also KotlinGenerator and ScalaGenerator to
>>>> work
>>>> out of the box, to get help prevent having to set up all the compiler and
>>>> library dependencies
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jooq-user/ee75b23d-8aa2-4f8e-9835-0ed72cd92901n%40googlegroups.com.