This repository was archived by the owner on Jul 13, 2025. It is now read-only.
fix: Make java lowerCamel methos naming match protobuf java stubs output methods naming#3265
Merged
vam-google merged 1 commit intogoogleapis:masterfrom Aug 7, 2020
Merged
Conversation
…put methods naming. Specifically, before this fix, for a field named `one_two3four` protobuf will generate java method named `setOneTwo3Four()`, while gapic generator would assume it to be `setOneTwo3four()`.
miraleung
approved these changes
Aug 7, 2020
Codecov Report
@@ Coverage Diff @@
## master #3265 +/- ##
============================================
+ Coverage 87.11% 87.12% +0.01%
- Complexity 6077 6080 +3
============================================
Files 494 494
Lines 24058 24060 +2
Branches 2613 2613
============================================
+ Hits 20957 20962 +5
+ Misses 2238 2236 -2
+ Partials 863 862 -1
Continue to review full report at Codecov.
|
| return capitalizeDigitsAfterNumbers(toLowerCamel()); | ||
| } | ||
|
|
||
| private String capitalizeDigitsAfterNumbers(String camelCaseIdentifier) { |
Contributor
There was a problem hiding this comment.
late to the party, but I bet it meant to be capitalizeLettersAfterNumbers :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Specifically, before this fix, for a field named
one_two3fourprotobuf was generating java method namedsetOneTwo3Four(), while gapic generator was assuming it to besetOneTwo3four().This change is applied in the most limited scope (only for java methods naming, because this logic is applied only for methods naming in protobuf). This should be a relatively safe change because protobuf in general does not let fields to differ only by the underscore characters
_. I.e. one message cannot have two fields one namedone_twoand the other oneonetwooroneTwo. This restriction greatly reduces number of possiblesnake_casecamelCaseconversion combinations.