diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | java/core/generate-test-sources-build.xml | 1 | ||||
-rw-r--r-- | src/google/protobuf/compiler/java/java_file.cc | 7 |
3 files changed, 7 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index aaf9e7d4..cd1cfc3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -333,6 +333,7 @@ java_EXTRA_DIST= java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java \ java/core/src/test/java/com/google/protobuf/WireFormatTest.java \ java/core/src/test/proto/com/google/protobuf/any_test.proto \ + java/core/src/test/proto/com/google/protobuf/deprecated_file.proto \ java/core/src/test/proto/com/google/protobuf/field_presence_test.proto \ java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto \ java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto \ diff --git a/java/core/generate-test-sources-build.xml b/java/core/generate-test-sources-build.xml index 68951747..abcdf5dd 100644 --- a/java/core/generate-test-sources-build.xml +++ b/java/core/generate-test-sources-build.xml @@ -19,6 +19,7 @@ <arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/> <arg value="${protobuf.source.dir}/google/protobuf/unittest_no_generic_services.proto"/> <arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/> + <arg value="${test.proto.dir}/com/google/protobuf/deprecated_file.proto"/> <arg value="${test.proto.dir}/com/google/protobuf/lazy_fields_lite.proto"/> <arg value="${test.proto.dir}/com/google/protobuf/lite_equals_and_hash.proto"/> <arg value="${test.proto.dir}/com/google/protobuf/multiple_files_test.proto"/> diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc index 2d5465ba..21133a15 100644 --- a/src/google/protobuf/compiler/java/java_file.cc +++ b/src/google/protobuf/compiler/java/java_file.cc @@ -248,9 +248,12 @@ void FileGenerator::Generate(io::Printer* printer) { PrintGeneratedAnnotation( printer, '$', options_.annotate_code ? classname_ + ".java.pb.meta" : ""); printer->Print( - "public final class $classname$ {\n" + "$deprecation$public final class $classname$ {\n" " private $ctor$() {}\n", - "classname", classname_, "ctor", classname_); + "deprecation", file_->options().deprecated() ? + "@java.lang.Deprecated " : "", + "classname", classname_, + "ctor", classname_); printer->Annotate("classname", file_->name()); printer->Indent(); |