-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[dart][dart-dio] Prevent name collisions for fields with leading _ #14709
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have potential collisions here and we also loose double (multiple) underscores due to the implementation of the camelize method. But I am not sure it is worth to rewrite it all.
|
We also convert |
|
built value only prefixes class names with $, but it's a valid identifier to use. |
Yea it probably is like that since the dawn of time because the generator just used the the Java way of things. I am not sure how to proceed, any change, even the current one is breaking some cases but on the other hand it is also a bug... |
* leading underscores `_` mark private fields in Dart, so until now we just removed them * but just removing the fields can lead to name collision and missing fields * a prominent use-case are fields `id` and `_id` which previously would result in the `_id` field being lost on the Dart side
1c34fe9 to
ed376e2
Compare
|
well, my suggestion is that if we are going to break anyway, lets do it right |

_mark private fields in Dart, so until now we just removed themidand_idwhich previously would result in the_idfield being lost on the Dart sidePR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(6.3.0) (minor release - breaking changes with fallbacks),7.0.x(breaking changes without fallbacks)CC @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)