Conversation
|
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. |
518b85a to
87d61ba
Compare
|
@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. |
|
This pull request is stale because it has been open 6 months with no activity. Please comment or label |
|
I'm still hoping to get this merged. Not stale. |
87d61ba to
5c41cec
Compare
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 google#7940
aardappel
left a comment
There was a problem hiding this comment.
This looks like a nice change, and clearly some effort went into making it work for all languages, thanks!
My only issue is with the way it is tested, it was added to an existing field in samples. samples are as an example, not for testing. Also better to add a new field for it. So I'd suggest to instead add it to tests/monster_test.fbs as one additional field at the end, e.g. test_desprecated_readonly:bool = true (desprecated_readonly). No buffers will have this field, but that is fine, they can still read the default value.
|
Hmm, this PR seems to cause a fuzzing fail, something to do with reflection/binary schemas: https://github.com/google/flatbuffers/actions/runs/16607053932/job/46981960954 It also looks like it is missing changed test code.. though probably easier to first change how it is tested, see above. There's also Rust failures. |
|
This pull request is stale because it has been open 6 months with no activity. Please comment or label |
|
Not stale. I still intend to continue this PR. Just been busy. |
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.