You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2009/05/29 22:15:04 UTC

svn commit: r780091 - /incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc

Author: bryanduxbury
Date: Fri May 29 20:15:02 2009
New Revision: 780091

URL: http://svn.apache.org/viewvc?rev=780091&view=rev
Log:
THRIFT-489. java: Java enum validation only validates explicitly assigned values

This patch puts all of an enum's values into the valid values set, fixing validation. 


Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc?rev=780091&r1=780090&r2=780091&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc Fri May 29 20:15:02 2009
@@ -360,13 +360,12 @@
   bool first = true;
   for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
     // populate set
-    if ((*c_iter)->has_value()) {
-      f_enum << (first ? "" : ", ") << (*c_iter)->get_name();
-      first = false;
-    }
+    f_enum << (first ? "" : ", ") << endl;
+    first = false;
+    indent(f_enum) << (*c_iter)->get_name();
   }
+  f_enum << " );" << endl << endl;
   indent_down();
-  f_enum << ");" << endl;
 
   indent(f_enum) << "public static final Map<Integer, String> VALUES_TO_NAMES = new HashMap<Integer, String>() {{" << endl;