question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Kotlin inline classes [DATACMNS-1517]

See original GitHub issue

Wyatt Smith opened DATACMNS-1517 and commented

Here is an example with the bug: https://github.com/wyattjsmith1/SpringDataBug

When this runs, there is an IndexOutOfBoundsException. This is caused by kotlin’s synthetic constructor. I believe the issues is that synthetic constructors aren’t filtered before.

buildPreferredConstructor at org.springframework.data.mapping.model.PreferredConstructorDiscoverer.Discoverers#discover, but there is probably a better solution to this.

Changing AccountId in the data class to a String causes the application to work properly. Admittedly, inline classes are still experimental for Kotlin, but this might be worth investigating


Issue Links:

  • DATAGRAPH-1330 Properties with type of Kotlin inline class has mangled name

7 votes, 10 watchers

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:26
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
sangyongchoicommented, Oct 8, 2022

Hi, i am user using spring data with kotlin. Any progress on this?

3reactions
matthewadamscommented, Jun 19, 2021

Answered my own question, thanks to https://github.com/spring-projects/spring-data-commons/issues/2215#issuecomment-752410346. I was using unsigned types. Changing them to Int made the issue go away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inline classes | Kotlin
Inline classes support some functionality of regular classes. ... functions using inline classes are mangled by adding some stable hashcode ...
Read more >
Store Kotlin inline class to MongoDB with Spring Data
I'm using a workaround for this, by introducing a private field. inline class UserId(@NotBlank val id: String = UUID.randomUUID().
Read more >
How to Enable Kotlin 1.3 Inline Classes Today
Include Kotlin support if you're in Android Studio. Walk through the rest of the setup wizard. 3. Add the repository. The Kotlin build...
Read more >
spring-projects/spring-data - Gitter
Is there something I can do to make kotlin inline classes work with Spring Data Mongo (Reactive) on my side? There's an issue...
Read more >
ArrayIndexOutOfBoundsException when using inline class as ...
From https://jira.spring.io/browse/DATACMNS-1517: When this runs, there is an IndexOutOfBoundsException. This is caused by kotlin's synthetic constructor. I ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found