Don't generate a constants file if there are no constants (Java only).


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666372 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index 6268adf..0c0f287 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -315,6 +315,10 @@
  * 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());