Skip to content
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

KSP: Fixed method isEnum() for KotlinTypeArgumentElement #11422

Open
wants to merge 1 commit into
base: 4.8.x
Choose a base branch
from

Conversation

altro3
Copy link
Contributor

@altro3 altro3 commented Dec 8, 2024

No description provided.

@altro3
Copy link
Contributor Author

altro3 commented Dec 8, 2024

@dstepanov Review it, pls. Found this problem in simple test in micronaut-openapi:

@Controller("/hello")
class HelloController {

    @Get
    @Produces(MediaType.TEXT_PLAIN)
    fun index(@Nullable @QueryValue("channels") channels: Collection<Channel?>?) = ""

    @Introspected
    enum class Channel {
        @JsonProperty("mysys")
        SYSTEM1,
        SYSTEM2
    }
}

When I get typeArgument for Collection type, I get KotlinTypeArgumentElement element, and default isEnum() implemention is

    default boolean isEnum() {
        return this instanceof EnumElement;
    }

That's why method isEnum() returns false, but must be true

@graemerocher graemerocher added the type: improvement A minor improvement to an existing feature label Dec 9, 2024
@sdelamo sdelamo requested a review from dstepanov December 12, 2024 16:25
@sdelamo sdelamo added the lang: kotlin Issues or features specific to Kotlin label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: kotlin Issues or features specific to Kotlin type: improvement A minor improvement to an existing feature
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants