Skip to content

Kotlin ValueBoxing breaks entity instantiator for data classes that has generic field #2986

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

Closed
ajax-kanarik-v opened this issue Nov 24, 2023 · 1 comment
Assignees
Labels
type: bug A general bug

Comments

@ajax-kanarik-v
Copy link

ajax-kanarik-v commented Nov 24, 2023

As for now, there is check for generic type if it's generic value class field, and that's working normally

nestedType.getClassifier() instanceof KTypeParameter ktp

but it fails with class cast exception when this constructor is being invoked with the KType parameter

private ValueBoxing(BoxingRules rules, KParameter parameter) {
    this(rules, parameter.getType(), (KClass<?>) parameter.getType().getClassifier(), parameter.isOptional());
}

Example data class :

data class Foo<T>{val bar: T? = null)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 24, 2023
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 24, 2023
@mp911de mp911de self-assigned this Nov 24, 2023
@mp911de mp911de added this to the 3.2.1 (2023.1.1) milestone Dec 14, 2023
mp911de added a commit that referenced this issue Dec 14, 2023
To introspect value boxing rules, we now resolve Kotlin type parameters.

Closes #2986
@mp911de
Copy link
Member

mp911de commented Dec 14, 2023

That's fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants