Search code examples
javaprotocol-buffersprotoc

Protobuf field names with numbers are capitalized in a unexpected way


I have a message:

message Image {

    string link_40dp = 1;
}

After the compilation, in Java, the field name is link40Dp (the first letter after a number is capitalized). But, I am expecting, that the field name would be link40dp (d in lower case).

Is it expected behavior or bug? Are there other corner-cases like this?

I am using Protobuf Gradle Plugin v0.8.5 and Protoc v3.6.1 to generate messages in Java.


Solution

  • I went through sources and found that it is the expected behavior.

    See the code of the capitalization. All the capitalization rules can be found in the code snippet.