Commit d7339318 authored by jieluo@google.com's avatar jieluo@google.com

Change java descriptor back to private

parent 83964a9a
...@@ -231,7 +231,7 @@ void EnumGenerator::Generate(io::Printer* printer) { ...@@ -231,7 +231,7 @@ void EnumGenerator::Generate(io::Printer* printer) {
"index", SimpleItoa(descriptor_->index())); "index", SimpleItoa(descriptor_->index()));
} }
printer->Print( printer->Print(
"return $immutable_package$.$descriptor_class$.descriptor\n" "return $immutable_package$.$descriptor_class$.getDescriptor()\n"
" .getEnumTypes().get($index$);\n", " .getEnumTypes().get($index$);\n",
"immutable_package", FileJavaPackage(descriptor_->file(), true), "immutable_package", FileJavaPackage(descriptor_->file(), true),
"descriptor_class", "descriptor_class",
......
...@@ -315,7 +315,7 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable( ...@@ -315,7 +315,7 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable(
" getDescriptor() {\n" " getDescriptor() {\n"
" return descriptor;\n" " return descriptor;\n"
"}\n" "}\n"
"public static com.google.protobuf.Descriptors.FileDescriptor\n" "private static com.google.protobuf.Descriptors.FileDescriptor\n"
" descriptor;\n" " descriptor;\n"
"static {\n"); "static {\n");
printer->Indent(); printer->Indent();
......
...@@ -176,36 +176,16 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) { ...@@ -176,36 +176,16 @@ void SharedCodeGenerator::GenerateDescriptors(io::Printer* printer) {
// Invoke internalBuildGeneratedFileFrom() to build the file. // Invoke internalBuildGeneratedFileFrom() to build the file.
printer->Print( printer->Print(
"com.google.protobuf.Descriptors.FileDescriptor\n" "com.google.protobuf.Descriptors.FileDescriptor\n"
" .internalBuildGeneratedFileFrom(descriptorData,\n"); " .internalBuildGeneratedFileFrom(descriptorData,\n"
" new com.google.protobuf.Descriptors.FileDescriptor[] {\n");
printer->Print(
" $classname$.class,\n"
" new java.lang.String[] {\n",
"classname", name_resolver_->GetDescriptorClassName(file_));
for (int i = 0; i < dependencies.size(); i++) { for (int i = 0; i < dependencies.size(); i++) {
const string& dependency = dependencies[i].second; const string& dependency = dependencies[i].second;
printer->Print( printer->Print(
// Here we load the dependency FileDescriptors lazily via Java " $dependency$.getDescriptor(),\n",
// reflection. This is to avoid breaking proto1 targets who have
// genproto dependencies for which we can't generate the descriptor
// class. They will compile fine but when users try to call reflection
// functions upon them it will fail. Users will have to get rid of
// genproto dependencies before they can use proto2 reflection on
// proto1 messages.
" \"$dependency$\",\n",
"dependency", dependency); "dependency", dependency);
} }
printer->Print(
" }, new java.lang.String[] {\n");
for (int i = 0; i < dependencies.size(); i++) {
const string& filename = dependencies[i].first;
printer->Print(
" \"$filename$\",\n",
"filename", filename);
}
printer->Print( printer->Print(
" }, assigner);\n"); " }, assigner);\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment