Generalize processing of doc-annotations in JsonRpcDataProcessor#941
Merged
Conversation
jonahgraham
approved these changes
Dec 11, 2025
jonahgraham
left a comment
Contributor
There was a problem hiding this comment.
This looks good - I very much like the fact that we wont forget next time to edit this if a new annotation is introduced.
Contributor
Author
Great, thanks for the review! 👍
That's it! A nice side-effect is that the doc-annotations would appear on the generated getter and setter in exactly the same order as they do on the field declaration in the source. |
This file contains hidden or 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
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.
Currently,
JsonRpcDataProcessorcopies the doc-comment and selected annotations such as@ProtocolDeprecated,@ProtocolDraft,@ProtocolSince, and@Deprecatedfrom a field of a protocol class to the generated getter and setter for the field.I think that this processing can and should be generalized to include all doc-annotations (i.e. all annotations annotated with
@Documented), since by definition all doc-annotations are considered part of the element's public contract and, therefore, should be copied to the generated getter and setter along with the doc-comment they essentially part of.If
JsonRpcDataProcessorwere implemented in this way, we would not need to modify it to add special processing for the@ProtocolDeprecated,@ProtocolDraft, and@ProtocolSinceannotations introduced recently. It would just work.