Repository: google/flatbuffers
File: grpc/src/compiler/java_generator.cc (C++)

Code before:
typedef grpc_generator::CommentHolder
    DescriptorType;  // base class of all 'descriptors'
typedef grpc_generator::Method MethodDescriptor;

namespace grpc_java_generator {
typedef std::string string;
namespace {
// Generates imports for the service
void GenerateImports(grpc_generator::File *file,
                     grpc_generator::Printer *printer, VARS &vars) {
  vars["filename"] = file->filename();
  printer->Print(vars,
                 "//Generated by flatc compiler (version $flatc_version$)\n");
  printer->Print("//If you make any local changes, they will be lost\n");
  printer->Print(vars, "//source: $filename$.fbs\n\n");
  printer->Print(vars, "package $Package$;\n\n");
  vars["Package"] = vars["Package"] + ".";
  if (!file->additional_headers().empty()) {
    printer->Print(file->additional_headers().c_str());
    printer->Print("\n\n");
  }
}

// Adjust a method name prefix identifier to follow the JavaBean spec:
//   - decapitalize the first letter
//   - remove embedded underscores & capitalize the following letter
string MixedLower(const string &word) {
  string w;
  w += static_cast<string::value_type>(tolower(word[0]));
  bool after_underscore = false;
  for (size_t i = 1; i < word.length(); ++i) {
    if (word[i] == '_') {
      after_underscore = true;
    } else {
      w += after_underscore ? static_cast<string::value_type>(toupper(word[i]))
                            : word[i];
      after_underscore = false;
    }
  }
  return w;
}

// Converts to the identifier to the ALL_UPPER_CASE format.
//   - An underscore is inserted where a lower case letter is followed by an
//     upper case letter.
//   - All letters are converted to upper case
string ToAllUpperCase(const string &word) {
  string w;
  for (size_t i = 0; i < word.length(); ++i) {
    w += static_cast<string::value_type>(toupper(word[i]));
    if ((i < word.length() - 1) && islower(word[i]) && isupper(word[i + 1])) {

Review comment (suggestion):
you can leave the static too, sorry I should have mentioned that. I know they do the same thing, but it is nice to easily grok that a function is static looking at it signature, and organizational-wise, they are nice to be grouped together in the namespace. 

Code after:
typedef grpc_generator::CommentHolder
    DescriptorType;  // base class of all 'descriptors'
typedef grpc_generator::Method MethodDescriptor;

namespace grpc_java_generator {
typedef std::string string;
namespace {
// Generates imports for the service
static void GenerateImports(grpc_generator::File *file,
                     grpc_generator::Printer *printer, VARS &vars) {
  vars["filename"] = file->filename();
  printer->Print(vars,
                 "//Generated by flatc compiler (version $flatc_version$)\n");
  printer->Print("//If you make any local changes, they will be lost\n");
  printer->Print(vars, "//source: $filename$.fbs\n\n");
  printer->Print(vars, "package $Package$;\n\n");
  vars["Package"] = vars["Package"] + ".";
  if (!file->additional_headers().empty()) {
    printer->Print(file->additional_headers().c_str());
    printer->Print("\n\n");
  }
}

// Adjust a method name prefix identifier to follow the JavaBean spec:
//   - decapitalize the first letter
//   - remove embedded underscores & capitalize the following letter
static string MixedLower(const string &word) {
  string w;
  w += static_cast<string::value_type>(tolower(word[0]));
  bool after_underscore = false;
  for (size_t i = 1; i < word.length(); ++i) {
    if (word[i] == '_') {
      after_underscore = true;
    } else {
      w += after_underscore ? static_cast<string::value_type>(toupper(word[i]))
                            : word[i];
      after_underscore = false;
    }
  }
  return w;
}

// Converts to the identifier to the ALL_UPPER_CASE format.
//   - An underscore is inserted where a lower case letter is followed by an
//     upper case letter.
//   - All letters are converted to upper case
static string ToAllUpperCase(const string &word) {
  string w;
  for (size_t i = 0; i < word.length(); ++i) {
    w += static_cast<string::value_type>(toupper(word[i]));
    if ((i < word.length() - 1) && islower(word[i]) && isupper(word[i + 1])) {