-
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
feat(ksp): add option to convert KSAnnotation to AnnotationSpec while omitting default values #1538
Conversation
… omitting default values
Any feedback or reason why not to merge this? |
interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/Annotations.kt
Outdated
Show resolved
Hide resolved
Is there anything preventing the acceptance of this PR? |
Yes, the two comments left in code review |
But I am not the one who should answer them, as the questions are (in my point of view) related to the library owners.
I have no idea what the ksp.api file is and why it seems to be incompatible. I just added a boolean parameter with a default value. Most (or probably any) existing code should work as before and its behavior will remains unchanged.
I have no idea if there is a plan to ever run this without java. Is there a plan to run KSP without java? Or is this even already possible? I just oriented on the solution already existing in kotlinpoet (without ksp): https://github.com/square/kotlinpoet/blob/master/kotlinpoet/src/main/java/com/squareup/kotlinpoet/AnnotationSpec.kt#L210 |
That's not true. You can see it in the updated binary compatibility file you committed here: https://github.com/square/kotlinpoet/pull/1538/files#diff-03a0dab0a934dcdd578aba4e325fd542f74158af6c2e6a4d3380b1c024720d04R2-R3. You should add For the second one, Egor was just asking if there's a non JVM-only (i.e. in the kotlin stdlib or kotlin-reflect) option to do deep equals checks. |
As I said, I had no idea what that file is for and what the problem was. For future readers, have a look here to understand the background of these files: https://github.com/Kotlin/binary-compatibility-validator
I had thought about that and why I added it in the first place. I think it is not necessary, as the values seem to always be Lists instead of arrays and for that I already implemented the check. |
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 for the PR and addressing the comments!
As I said, I had no idea what that file is for and what the problem was.
Then ask :). It's the maintainers' responsibility to help contributors understand the impact of what they're doing, but it's also on the contributors to seek that understanding when they are changing code they don't understand. As you didn't respond to the review comment, it wasn't clear what your position was.
Adds the possibility in ksp annotaitons extension functions to define to not include the default values when converting a
KSAnnotation
to anAnnotationSpec
.This is the ksp "equivalent" of AnnotationSpec.get and does not change the current behaviour.