-
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
KSP2: default annotation arguments no longer work in 1.0.21 #1909
Comments
This seems to be limited to |
To me it seems that this should never worked. The cause here is the default value is not explicitly declared in the source therefore it should get assigned automatically, KSP2 is parsing the binary class file to get the default value but the check failed to find a default value in the class file. Ideally we should assign a default value according to the type, which should be |
It appears to have same issue in KSP1 |
Hi @ZacSweers given this is also an issue in KSP1, do you know what's the last working version? I wonder if this is due to updates in the class file visitor versions if any. At the same time, for this case in particular, I think I can try to manually assign default values based on the types of the annotation argument if that helps. |
This test passed on main, which is on |
Per the language spec JLS-9.6.2, annotations defined without a default value must have the corresponding value specified at use site, failed to do so should result in a compilation error. I feel this might be a mistake use case to apply a default value when there is no default value specified at declaration site. With that being said, we still need to address the issue where we ignored the annotation values in case of a missing value use case. I will add a special default value for arrays but I will leave the rest of the default value types to return |
Example using auto service
The below sample
Results in a
KSAnnotation
that reports that bothannotation.arguments
andannotation.defaultArguments
are empty.Repro is the failing test in ZacSweers/auto-service-ksp#89
The text was updated successfully, but these errors were encountered: