Fix a bug with initialization in JavaBean-style generated code.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Reiss 2008-06-10 22:56:34 +00:00
parent 5245f40b3e
commit 87e9ac6382

View File

@ -384,7 +384,15 @@ void t_java_generator::print_const_value(std::ofstream& out, string name, t_type
throw "type error: " + type->get_name() + " has no field " + v_iter->first->get_string();
}
string val = render_const_value(out, name, field_type, v_iter->second);
indent(out) << name << "." << v_iter->first->get_string() << " = " << val << ";" << endl;
indent(out) << name << ".";
if (bean_style_) {
std::string cap_name = v_iter->first->get_string();
cap_name[0] = toupper(cap_name[0]);
out << "set" << cap_name << "(" << val << ")";
} else {
out << v_iter->first->get_string() << " = " << val;
}
out << ";" << endl;
indent(out) << name << ".__isset." << v_iter->first->get_string() << " = true;" << endl;
}
if (!in_static) {