-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[Java] Use Fully Qualified Name for java.util.Locale in Generated Classes
#22342
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
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
|
@wing328 really not sure why it is failing. The error indicates that the samples are not updated, but they are 🤔 Edit: nevermind, the /bin structure is unlike the /resources structure, so had so also re-run "spring*" 🤦 |
Signed-off-by: Chrimle <[email protected]>
Signed-off-by: Chrimle <[email protected]>
|
Hello @Chrimle, I am not a maintainer, but this change looks sensible to me. I really like that you changed it everywhere even though it might theoretically not cause an issue everywhere, since I expect others can be expected to follow the style going forward when submitting a PR. As is, I am afraid that someone might unknowingly reintroduce this bug with good intentions. Maybe at least a unit test with api spec testing for the absence of import java.util.Locale and presence of the FQN would make sense? But I understand testing it everywhere would be pretty excessive. But anything is better than nothing in my opinion. |
|
@Picazsoo Correction; Initially ALL imports were replaced by inline:ing. However, on second thought, it was deemed a bit risky, since it would affect non-pojo classes. Hence, it was reverted, and only the mustache-files modified in #21871 , were partially reverted (removing the imports) and the usage of This means, classes pre-7.16.0 that were importing Edit: Should the PR title be reworded to better reflect this? Suggestions welcomed |
java.util.Locale Usagesjava.util.Locale in Generated Classes
|
@Chrimle - I kind of understand the intention with limiting the scope of the changes. But where do you see risk with inlining everywhere? I don't think the issues in non-pojo classes would be any different than in POJOs. FQN seems overall much more safe anywhere in generated code as it can nicely coexist with any other instance of user-provided custom |
|
@Picazsoo My philosophy was:
This way, the original PR is kept as-was as much as possible, with the only modification being to address NEW issues with custom But overall, I would be indifferent to the idea. Would like know if the Tech committee leans towards one or the other. Ping 🔔 |
|
I would expect the same issues in the generated API classes (controllers/interfaces/delegates) when e.g. using a custom user-defined schema called |
Fixes #22313 and fixes #22269, by doing a partial revert of #21871, and replacing all introduced
import java.util.Locale;with Fully-Qualified uses i.e.java.util.Locale. The reason is that the import ofjava.util.Localewill clash/conflict with any other class namedLocalein the current package. The intention is to again allow custom classes, pojos/enums, to be namedLocaleand to be used in other generated classes, as it was pre-v7.16.0.PR checklist
Commit all changed files.
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*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)