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

Change TypeParameter to be a Expression, to support kotlin intersection type #3718

Closed
wants to merge 1 commit into from

Conversation

kunli2
Copy link
Contributor

@kunli2 kunli2 commented Nov 21, 2023

This change is to support Kotlin intersection type like this

              import java.util.*

              @Suppress("UNUSED_PARAMETER")
              fun <T : Any?> test(n: Optional <  T   &    Any > = Optional.empty<T>()) {}

Optional < T & Any > is a J.ParameterizedType,
If we parse T & Any as a J.TypeParameter, then it needs to be a J.Expression since J.ParameterizedType requires a JContainer<Expression> for type parameters.

There is an alternative way to avoid this change, which is to parse T & Any to a K.Binary with a new binary type.

@knutwannheden
Copy link
Contributor

I think we should first finish and integrate #3652 which will introduce J.IntersectionType.

@kunli2 kunli2 closed this Nov 21, 2023
@kunli2
Copy link
Contributor Author

kunli2 commented Nov 21, 2023

yes, let's use J.IntersectionType instead.

@timtebeek timtebeek deleted the TypeParameterAsExpression branch January 14, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants