naming convention not properly handled when generating java code
paolocanaletti opened this issue · 3 comments
Where the .proto file contains numbers and/or _ in the variable name the java code generated is not compiling.
Tested with latest version.
e.g.
providing a .proto file like the following
syntax = "proto3";
...
message Test {
optional string id1issuertype= 1;
}
it will produce a java code where a method is defined as:
(note the uppercase I after 1)
boolean hasId1Issuertype();
but is then used as
(note the lowercase i after 1)
```
public java.util.Optional getOptionalId1issuertype() {
if (hasId1issuertype()) {
return java.util.Optional.of(getId1issuertype());
} else {
return java.util.Optional.empty();
}
}
it works properly if instead the char after the number is already uppercase in proto definition.
e.g.
optional string id1Issuertype= 1;
I can replicate the issue when the variable is named id1issuertype
, but you mention and/or _ in the variable name
, can you give such example? Suggested naming pattern for protobuf variables is snake_case
for which it works.
This uses standard protobuf library to get the definition and method names from proto files, so strange that they would parse it one way and then in java they would apply a different case.
I am not able to replicate anymore the issue with _ , maybe I was confused by the test I did with different combination of numbers and _ , ignore the _
Should be fixed in 1.10.0