- Make the Java generator use program->get_namespace("java")
instead of program->get_java_namespace()
- Eliminate the explicit "java_namespace" in t_program.
- Deprecate the java_namespace token.
- Update example .thrift files and syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665514
13f79535-47bb-0310-9956-
ffa450edef68
void t_java_generator::init_generator() {
// Make output directory
MKDIR(get_out_dir().c_str());
- package_name_ = program_->get_java_package();
+ package_name_ = program_->get_namespace("java");
string dir = package_name_;
string subdir = get_out_dir();
// Check for namespacing
t_program* program = ttype->get_program();
if (program != NULL && program != program_) {
- string package = program->get_java_package();
+ string package = program->get_namespace("java");
if (!package.empty()) {
return package + "." + ttype->get_name();
}
return php_namespace_;
}
- void set_java_package(std::string java_package) {
- java_package_ = java_package;
- }
-
- const std::string& get_java_package() const {
- return java_package_;
- }
-
void set_csharp_namespace(std::string csharp_namespace) {
csharp_namespace_ = csharp_namespace;
}
// PHP namespace
std::string php_namespace_;
- // Java package
- std::string java_package_;
-
// XSD namespace
std::string xsd_namespace_;
g_program->set_smalltalk_prefix($2);
}
}
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
| tok_java_package tok_identifier
{
+ pwarning(1, "'cpp_namespace' is deprecated. Use 'namespace cpp' instead");
pdebug("Header -> tok_java_package tok_identifier");
if (g_parse_mode == PROGRAM) {
- g_program->set_java_package($2);
+ g_program->set_namespace("java", $2);
}
}
| tok_cocoa_prefix tok_identifier
* Seriously, this is the documentation for this whole program.
*/
-java_package thrift.test
+namespace java thrift.test
namespace cpp thrift.test
// C++ comment
-java_package thrift.test
+namespace java thrift.test
namespace cpp thrift.test
ruby_namespace Thrift.Test
perl_package ThriftTest
(defconst thrift-font-lock-keywords
(list
'("#.*$" . font-lock-comment-face) ;; perl style comments
- '("\\<\\(include\\|struct\\|exception\\|typedef\\|java_package\\|cocoa_prefix\\|csharp_namespace\\|php_namespace\\|ruby_namespace\\|py_module\\|perl_package\\|smalltalk_category\\|smalltalk_prefix\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
+ '("\\<\\(include\\|struct\\|exception\\|typedef\\|cocoa_prefix\\|csharp_namespace\\|php_namespace\\|ruby_namespace\\|py_module\\|perl_package\\|smalltalk_category\\|smalltalk_prefix\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
'("\\<\\(bool\\|byte\\|i16\\|i32\\|i64\\|double\\|string\\|binary\\|map\\|list\\|set\\)\\>" . font-lock-type-face) ;; built-in types
'("\\<\\([0-9]+\\)\\>" . font-lock-variable-name-face) ;; ordinals
'("\\<\\(\\w+\\)\\s-*(" (1 font-lock-function-name-face)) ;; functions
syn match thriftNumber "-\=\<\d\+\>" contained
" Keywords
-syn keyword thriftKeyword namespace java_package cocoa_prefix
+syn keyword thriftKeyword namespace cocoa_prefix
syn keyword thriftKeyword csharp_namespace smalltalk_category smalltalk_prefix
syn keyword thriftKeyword php_namespace ruby_namespace py_module perl_package
syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_namespace xsd_attrs
*/
namespace cpp shared
-java_package shared
+namespace java shared
perl_package shared
struct SharedStruct {
* target languages.
*/
namespace cpp tutorial
-java_package tutorial
+namespace java tutorial
php_namespace tutorial
perl_package tutorial
smalltalk_category Thrift-Tutorial