Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

fix: Make java lowerCamel methos naming match protobuf java stubs output methods naming #3265

Merged
merged 1 commit into from
Aug 7, 2020

Conversation

vam-google
Copy link
Contributor

@vam-google vam-google commented Aug 7, 2020

Specifically, before this fix, for a field named one_two3four protobuf was generating java method named setOneTwo3Four(), while gapic generator was assuming it to be setOneTwo3four().

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 named one_two and the other one onetwo or oneTwo. This restriction greatly reduces number of possible snake_case camelCase conversion combinations.

…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()`.
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 7, 2020
@codecov
Copy link

codecov bot commented Aug 7, 2020

Codecov Report

Merging #3265 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/com/google/api/codegen/util/Name.java 84.51% <100.00%> (+2.16%) 60.00 <6.00> (+3.00)
...oogle/api/codegen/util/java/JavaNameFormatter.java 76.00% <100.00%> (ø) 15.00 <1.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1485371...3a8395a. Read the comment docs.

@vam-google vam-google merged commit 4d1eef9 into googleapis:master Aug 7, 2020
return capitalizeDigitsAfterNumbers(toLowerCamel());
}

private String capitalizeDigitsAfterNumbers(String camelCaseIdentifier) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

late to the party, but I bet it meant to be capitalizeLettersAfterNumbers :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants