-
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
Traversal order #260
Closed
Closed
Traversal order #260
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this ended up requiring producing jvm signatures, which is not a great added cost and does not feel great to turn on by default.
which developer needs to call? That could help avoid the cost in generic case but let processor owners call it when needed. |
copybara-service bot
pushed a commit
to androidx/androidx
that referenced
this pull request
Jan 29, 2021
This CL fixes a bug in KSP where the order of fields returned in a KSClassDeclaration does not necessarily match the order they were declared in the class. It only impacts compiled kotlin classes because Kotlin compiler orders field names when serializing the metadata. google/ksp#250 This particularly hurts Room as we generate the table structure based on this order. Even though Room is clever enough to consider the schema the same, the effects are still visible in both schema files and generated sql database. This CL is a port of a possible implementation in KSP: google/ksp#260 Unfortunately, merging that CL would mean KSP doing a lot more work for each class. The plan there is to first fix it in the kotlin compiler if possible and if not, add an API to get sorted fields (to avoid the cost when not necessary). Meanwhile, this CL is a band aid solution in Room so that developers won't have unexpected schema file changes when they move to KSP from KAPT. As this solution is best effort, it doesn't fail compilation if it fails to read fields. I've added a strict mode to XProcessing so that we can run it in tests with a requirement to always find the order but on developer's machine, it won't require this. This strict mode can be turned on via a system property, which we can use to collect more bug information when it doesn't work. Fixes: 177471948 Test: OrderOfFieldsTest Change-Id: If0cf346a7f92dbbf2094e0076ea9ed02de4e32fc
ting-yuan
added a commit
to ting-yuan/ksp
that referenced
this pull request
Sep 2, 2021
which is same as KSDeclarationContainer.declarations, except that the order of retrived declarations match their positions in source. This is adapted from google#260, whose author is Yigit Boyar <yboyar@google.com>.
ting-yuan
added a commit
to ting-yuan/ksp
that referenced
this pull request
Sep 2, 2021
which is same as KSDeclarationContainer.declarations, except that the order of retrived declarations match their positions in source. This is adapted from google#260, which is authored by Yigit Boyar <yboyar@google.com>.
ting-yuan
added a commit
that referenced
this pull request
Sep 2, 2021
which is same as KSDeclarationContainer.declarations, except that the order of retrived declarations match their positions in source. This is adapted from #260, which is authored by Yigit Boyar <yboyar@google.com>.
github-actions bot
pushed a commit
to ting-yuan/ksp
that referenced
this pull request
Sep 15, 2021
which is same as KSDeclarationContainer.declarations, except that the order of retrived declarations match their positions in source. This is adapted from google#260, which is authored by Yigit Boyar <yboyar@google.com>. (cherry picked from commit f710c5f)
pritisnivv
added a commit
to pritisnivv/ksp
that referenced
this pull request
Aug 24, 2024
which is same as KSDeclarationContainer.declarations, except that the order of retrived declarations match their positions in source. This is adapted from google/ksp#260, which is authored by Yigit Boyar <yboyar@google.com>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prototype for keeping declaration order in .class files that come from compiled kotlin code.