-
Notifications
You must be signed in to change notification settings - Fork 289
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
Allow copying a ParameterizedTypeName with new type arguments #1140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
kotlinpoet/src/test/java/com/squareup/kotlinpoet/ParameterizedTypeNameTest.kt
Outdated
Show resolved
Hide resolved
095dcbd
to
d582179
Compare
From an API standpoint I wonder if it would be better to have a withParameters instead. These overloaded copy functions are brittle historically |
I'd be OK with that too. In fact I was probably going to add a |
IMO |
If we are keeping copy I think it might make sense to expose the enclosing type and add both that and the raw type to the copy method. |
@ansman I'd be reluctant to expose those simply for consistency, without a use case. If there is a use case then we'll consider it. |
My current use cases are:
This isn't possible in all cases without exposing these things. |
Can you add a test case that wasn't possible before? The one here is possible with the previous API |
d582179
to
f053ffb
Compare
f053ffb
to
ba18571
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems ok to me, though that example has me 🤔🤔🤔
Yeah, the example isn't perhaps real since you'd access this as |
This fixes #1139