Exceptions after upgrading Kotlin 2.3.0 to Kotlin 2.3.20

26 views
Skip to first unread message

Julian Backes

unread,
Apr 7, 2026, 9:41:06 AM (2 days ago) Apr 7
to jooq...@googlegroups.com
Hello everyone,

We are using jOOQ Pro 3.20.11 (also tested with 3.21.1) together with Kotlin, and after upgrading Kotlin from 2.3.0 to 2.3.20 we are encountering exceptions when mapping jOOQ results to Kotlin data classes.

The simplest example would be:

data class SimpleIntTest(val id: Int)

This works without any issues in Kotlin 2.3.0, but in Kotlin 2.3.20 it throws the following exception:

org.jooq.exception.MappingException: No DefaultRecordMapper strategy applies to type class SimpleIntTest for row type (
  "public"."some_table"."id"
). Attempted strategies include (in this order):
- Is type an array (false)?
- Is type a Stream (false)?
- Does row type have only 1 column (false) and did ConverterProvider provide a Converter for type (check skipped)?
- Is type abstract (false)?
- Is type a org.jooq.Record (false)?
- Is type a mutable POJO (a POJO with setters or non-final members: false) and has a no-args constructor (check skipped)?
- Does type have a @ConstructorProperties annotated constructor (false) and is Settings.mapConstructorPropertiesParameterNames enabled (true)?
- Is type a java.lang.Record (check skipped) and is Settings.mapRecordComponentParameterNames enabled (false)?
- Is type a kotlin class (true) and is Settings.mapConstructorParameterNamesInKotlin enabled (true)?
- Is there a constructor that matches row type's degrees with nested fields (false) or flat fields (false)
- Is the type a top level class (true) or static nested class (false)?
-   (Inner classes cannot be created via reflection)
- Is Settings.mapConstructorParameterNames enabled (false)

    at org.jooq.impl.DefaultRecordMapper.init(DefaultRecordMapper.java:638)
    at org.jooq.impl.DefaultRecordMapper.<init>(DefaultRecordMapper.java:369)
    at org.jooq.impl.DefaultRecordMapper.<init>(DefaultRecordMapper.java:359)
    at org.jooq.impl.DefaultRecordMapperProvider.lambda$provide$0(DefaultRecordMapperProvider.java:77)
    at org.jooq.impl.Cache.run(Cache.java:124)
    at org.jooq.impl.DefaultRecordMapperProvider.provide(DefaultRecordMapperProvider.java:77)
    at org.jooq.impl.FieldsImpl.mapper(FieldsImpl.java:208)
    at org.jooq.impl.ResultQueryTrait.lambda$mapper$24(ResultQueryTrait.java:1567)
    at org.jooq.impl.DelayedRecordMapper.map(DelayedRecordMapper.java:67)
    at org.jooq.RecordMapper.apply(RecordMapper.java:87)
    at org.jooq.RecordMapper.apply(RecordMapper.java:72)
    at java.base/java.util.stream.Collectors.lambda$mapping$13(Collectors.java:432)
    at org.jooq.impl.Tools.collect(Tools.java:6913)
    at org.jooq.impl.AbstractCursor.collect(AbstractCursor.java:78)
    at org.jooq.impl.ResultQueryTrait.collect(ResultQueryTrait.java:360)
    at org.jooq.impl.ResultQueryTrait.fetchInto(ResultQueryTrait.java:1433)
    at (business code)

The query itself is very simple:

ctx.select(SOMETABLE.ID).from(SOMETABLE).fetchInto(SimpleIntTest::class.java)

I tried to debug it a bit, but I’m not sure whether this is actually a jOOQ issue or if something has changed in Kotlin.

As I understand it, jOOQ in DefaultRecordMapper.java tries to find the appropriate constructor of the data class. For that, jOOQ uses Kotlin Reflect. In Kotlin 2.3.0, Kotlin Reflect returns int as the Java type for the parameter, but in Kotlin 2.3.20 it returns Integer. Then jOOQ tries to invoke the constructor using this Integer, which fails because val id: Int "is compiled to" int id not Integer id.

I also didn’t immediately find anything in the Kotlin issue tracker (though I may have been searching incorrectly). Does anyone have an idea what might be going on here?

Best regards,
Julian
Reply all
Reply to author
Forward
0 new messages