Attribute deprecated_readonly #8192
Open
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.
Adds support for a
deprecated_readonlyattribute.While
deprecatedremoves the field entirely from generated code, both getters and setters,deprecated_readonlyonly removes the setters and keeps the getters.It's useful for backwards compatibility in some cases. A program might read a buffer written before the deprecation, read the deprecated field if it has a value, do some applicable conversion, and write to a non-deprecated field.
Fixes #7940
Some things to look out for
deprecated_readonlyattribute to thecolorfield in themonster.fbssample. Let me know if I should revert this.deprecated_readonlyto the middle ofreflection.fbsnext todeprecated. I'm not sure if this file needs to keep backwards conformity. If it does, let me know, and I'll move it to the end.deprecated_readonlyattribute. There was no easy way to do this and the solution I came up with I find a bit invasive. I put it in a separate commit for easy removal, if it comes to that.