Skip to content

KSValueArgument.value may return List<*> #3008

Description

@jaschdoc

The API specifies that KSValueArgument.value returns an Array of the above listed types, however, if an annotation is given in a Java file as @Anno(args = [arg1, arg2, ...]), then [arg1, arg2, ...] is returned as a java.util.ArrayList<*>. Thus, if you match on the result of KSValueArgument.value and match on any or all of the types declared in the documentation, there is a case where the match is non-exhaustive or rather where you never hit a valid branch.

The fix is to check for the ArrayList<*> type and convert it to a kotlin.Array<*> type.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3desirablebugSomething isn't workingcoreIssues related to the core implementation of KSP API.good first issueGood for newcomers

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions