diff options
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_file.cc')
-rw-r--r-- | src/google/protobuf/compiler/javanano/javanano_file.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_file.cc b/src/google/protobuf/compiler/javanano/javanano_file.cc index 75d0e44..4e9fe0a 100644 --- a/src/google/protobuf/compiler/javanano/javanano_file.cc +++ b/src/google/protobuf/compiler/javanano/javanano_file.cc @@ -163,17 +163,22 @@ void FileGenerator::Generate(io::Printer* printer) { // We don't import anything because we refer to all classes by their // fully-qualified names in the generated source. printer->Print( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "\n"); + "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"); if (!java_package_.empty()) { printer->Print( - "package $package$;\n" - "\n", + "\n" + "package $package$;\n", "package", java_package_); } + // Note: constants (from enums, emitted in the loop below) may have the same names as constants + // in the nested classes. This causes Java warnings, but is not fatal, so we suppress those + // warnings here in the top-most class declaration. printer->Print( + "\n" + "@SuppressWarnings(\"hiding\")\n" "public final class $classname$ {\n" + " \n" " private $classname$() {}\n", "classname", classname_); printer->Indent(); @@ -223,12 +228,11 @@ static void GenerateSibling(const string& package_dir, io::Printer printer(output.get(), '$'); printer.Print( - "// Generated by the protocol buffer compiler. DO NOT EDIT!\n" - "\n"); + "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"); if (!java_package.empty()) { printer.Print( - "package $package$;\n" - "\n", + "\n" + "package $package$;\n", "package", java_package); } |