Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

THRIFT-998. java: Using valueOf for base types in getFieldValue

valueOf saves us on memory for 'small' primitive types and costs us nothing in other situations, so it's an all-around win.

Patch: Takashi Yonebayashi

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1063818 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit d94cb081a1b304409d59c75115d68ad794e3d408 1 parent c0e2ef5
Bryan Duxbury authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  compiler/cpp/src/generate/t_java_generator.cc
View
2  compiler/cpp/src/generate/t_java_generator.cc
@@ -1690,7 +1690,7 @@ void t_java_generator::generate_reflection_getters(ostringstream& out, t_type* t
if (type->is_base_type() && !type->is_string()) {
t_base_type* base_type = (t_base_type*)type;
- indent(out) << "return new " << type_name(type, true, false) << "(" << (base_type->is_bool() ? "is" : "get") << cap_name << "());" << endl << endl;
+ indent(out) << "return " << type_name(type, true, false) << ".valueOf(" << (base_type->is_bool() ? "is" : "get") << cap_name << "());" << endl << endl;
} else {
indent(out) << "return get" << cap_name << "();" << endl << endl;
}
Please sign in to comment.
Something went wrong with that request. Please try again.