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/07/14 03:42:10 UTC

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

Author: bryanduxbury
Date: Tue Jul 14 01:42:09 2009
New Revision: 793778

URL: http://svn.apache.org/viewvc?rev=793778&view=rev
Log:
THRIFT-543. java: Generate normal style java files should respect the "optional" keyword when serializing 

As the summary suggests, this patch causes "optional" fields to be skipped if they are unset, even if they are primitives. As this patch is for the non-beans style generator, the user is expected to maintain the set/unset status themselves.


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=793778&r1=793777&r2=793778&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 Tue Jul 14 01:42:09 2009
@@ -1096,7 +1096,7 @@
         indent() << "if (this." << (*f_iter)->get_name() << " != null) {" << endl;
       indent_up();
     }
-    bool optional = bean_style_ && (*f_iter)->get_req() == t_field::T_OPTIONAL;
+    bool optional = (*f_iter)->get_req() == t_field::T_OPTIONAL;
     if (optional) {
       indent(out) << "if (" << generate_isset_check((*f_iter)) << ") {" << endl;
       indent_up();