-
Notifications
You must be signed in to change notification settings - Fork 264
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 Common Metadata Task Fails with null for default annotation arguments #885
Comments
This is still pending upstream fix, likely won't make it in 1.7.0 release. |
Any updates on this? |
No, it is not prioritized at the moment |
Can I somehow help with this? Is it a problem with KSP or the Kotlin compiler? |
The problem is within kotlin compiler, the compiler does not propagate the default arguments value into the metadata artifacts, therefore when such artifacts are used as a dependency, there is no way to get the value from it. It works in JVM because we manually parsed class files to get the value, but class files are not available on other platforms. |
Is there already an issue in the Kotlin YouTrack? |
Not sure, I will file one if it is not yet created. |
Could you provide the issue link so I can follow along there? I wasn't able to find it. |
Thanks for the reminder, created one in YouTrack: https://youtrack.jetbrains.com/issue/KT-59566/Annotation-default-value-is-not-populated-in-metadata-for-libraries |
I started seeing something similar after updating to KSP2:
Is this the same issue, and would https://youtrack.jetbrains.com/issue/KT-59526/Store-annotation-default-values-in-metadata-on-JVM fix it? |
KSP Version: 1.6.10-1.0.4
I have a class defined in commonMain for a testing module:
The place it fails is here
where I am taking the
KSValueArgument
and inferring return type into a data model in order to grab its value. When I run the processor on a specific target like jvm or android, it finds the proper default values. But running the common metadata task:All arguments are
null
from the corresponding annotationlike:
The fix is to ignore default values when
null
and also supply defaults in the processor, but that would introduce unnecessary duplication to keep the arguments up with their default values...The text was updated successfully, but these errors were encountered: