Don't generate a constants file if there are no constants (Java only).
authorDavid Reiss <dreiss@apache.org>
Tue, 10 Jun 2008 22:56:43 +0000 (22:56 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 10 Jun 2008 22:56:43 +0000 (22:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666372 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/generate/t_java_generator.cc

index 6268adf..0c0f287 100644 (file)
@@ -315,6 +315,10 @@ void t_java_generator::generate_enum(t_enum* tenum) {
  * Generates a class that holds all the constants.
  */
 void t_java_generator::generate_consts(std::vector<t_const*> consts) {
+  if (consts.empty()) {
+    return;
+  }
+
   string f_consts_name = package_dir_+"/Constants.java";
   ofstream f_consts;
   f_consts.open(f_consts_name.c_str());