THRIFT-1251. java: Generated java code should indicate which fields are required...
authorBryan Duxbury <bryanduxbury@apache.org>
Tue, 2 Aug 2011 23:10:32 +0000 (23:10 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Tue, 2 Aug 2011 23:10:32 +0000 (23:10 +0000)
Patch: Takashi Yonebayashi

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1153302 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/generate/t_java_generator.cc

index 1b55172..f9ed5e2 100644 (file)
@@ -3329,7 +3329,13 @@ string t_java_generator::declare_field(t_field* tfield, bool init) {
       result += " = new " + type_name(ttype, false, true) + "()";;
     }
   }
-  return result + ";";
+  result += "; // ";
+  if (tfield->get_xsd_optional()) {
+    result += "optional";
+  } else {
+    result += "required";
+  }
+  return result;
 }
 
 /**