Skip to content

Default generic type arguments when resolving KType for Class. #3048

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
wants to merge 4 commits into from

Conversation

christophstrobl
Copy link
Member

@christophstrobl christophstrobl commented Feb 21, 2024

We now fill up missing KTypeProjection arguments with star because the Kotlin Reflection.typeOf resolution fails if arguments are not provided.

Resolves: #3041

Verified

This commit was signed with the committer’s verified signature.
renovate-bot Mend Renovate

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
We now fill up missing KTypeProjection arguments with star because the Kotlin Reflection.typeOf resolution fails if arguments are not provided.

private static KTypeProjection[] stubKTypeProjections(KClass<?> kotlinClass) {

return IntStream.range(0, kotlinClass.getTypeParameters().size()).mapToObj(it -> KTypeProjection.star)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about new KTypeProjection[kotlinClass.getTypeParameters().size()] and Arrays.fill(…) instead of using heavy-weight Stream API?

mp911de pushed a commit that referenced this pull request Feb 21, 2024
We now fill up missing KTypeProjection arguments with star because the Kotlin Reflection.typeOf resolution fails if arguments are not provided.

Closes #3041
Original pull request: #3048
mp911de added a commit that referenced this pull request Feb 21, 2024
Tiny naming tweaks.

See #3041
Original pull request: #3048
mp911de pushed a commit that referenced this pull request Feb 21, 2024
We now fill up missing KTypeProjection arguments with star because the Kotlin Reflection.typeOf resolution fails if arguments are not provided.

Closes #3041
Original pull request: #3048
mp911de added a commit that referenced this pull request Feb 21, 2024
Tiny naming tweaks.

See #3041
Original pull request: #3048
@mp911de mp911de added the type: bug A general bug label Feb 21, 2024
@mp911de mp911de added this to the 3.2.4 (2023.1.4) milestone Feb 21, 2024
@mp911de mp911de closed this Feb 21, 2024
@mp911de mp911de deleted the issue/3041 branch February 21, 2024 13:40
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

Successfully merging this pull request may close these issues.

Kotlin constructor detection fails during KType derivation
2 participants