The lexer has been changed to make "final" a non-reserved word, and the java, csharp, and cpp compilers now look for the final annotation and amend their class declarations appropriately.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739788
13f79535-47bb-0310-9956-
ffa450edef68
scope_down(out);
}
- out <<
- endl <<
- indent() << "virtual ~" << tstruct->get_name() << "() throw() {}" << endl << endl;
+ if (tstruct->annotations_.find("final") == tstruct->annotations_.end()) {
+ out <<
+ endl <<
+ indent() << "virtual ~" << tstruct->get_name() << "() throw() {}" << endl << endl;
+ }
// Pointer to this structure's reflection local typespec.
if (gen_dense_) {
out << endl;
indent(out) << "[Serializable]" << endl;
- indent(out) << "public class " << tstruct->get_name() << " : ";
+ bool is_final = (tstruct->annotations_.find("final") != tstruct->annotations_.end());
+
+ indent(out) << "public " << (is_final ? "sealed " : "") << "class " << tstruct->get_name() << " : ";
if (is_exception) {
out << "Exception, ";
bool is_result) {
generate_java_doc(out, tstruct);
+ bool is_final = (tstruct->annotations_.find("final") != tstruct->annotations_.end());
+
indent(out) <<
- "public " << (in_class ? "static " : "") << "class " << tstruct->get_name() << " ";
+ "public " << (is_final ? "final " : "") <<
+ (in_class ? "static " : "") << "class " << tstruct->get_name() << " ";
if (is_exception) {
out << "extends Exception ";
"except" { thrift_reserved_keyword(yytext); }
"exec" { thrift_reserved_keyword(yytext); }
"false" { thrift_reserved_keyword(yytext); }
-"final" { thrift_reserved_keyword(yytext); }
"finally" { thrift_reserved_keyword(yytext); }
"float" { thrift_reserved_keyword(yytext); }
"for" { thrift_reserved_keyword(yytext); }