Attribute deprecated_readonly
Adds support for a deprecated_readonly attribute.
While deprecated removes the field entirely from generated code, both getters and setters, deprecated_readonly only 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 https://github.com/google/flatbuffers/issues/7940
Some things to look out for
- I have not fully tested the code generation of all languages. I have tested C++ and C#, the rest I've only visually inspected the generated code of. There might be edge cases I've missed, especially in languages I'm not familiar with.
- I took the liberty of adding the
deprecated_readonlyattribute to thecolorfield in themonster.fbssample. Let me know if I should revert this. - I added
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. - I wanted to have the C# json serializer support honor the
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.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
@dbaileychess Not sure what the proper etiquette is here, so apologies if tagging you like this is out of line, but I'd love to get this PR reviewed.