Add explicit default constructors to abstract Java classes.

This commit is contained in:
levlam 2022-09-08 15:40:09 +03:00
parent 4d5625a06f
commit bc950bc543
2 changed files with 24 additions and 1 deletions

View File

@ -141,6 +141,13 @@ EOT
* This class is a base class for all TDLib interface classes.
*/
EOT
);
$this->addDocumentation(" public Object() {", <<<EOT
/**
* Default Object constructor.
*/
EOT
);
$this->addDocumentation(' public abstract int getConstructor();', <<<EOT
@ -162,6 +169,13 @@ EOT
* This class is a base class for all TDLib interface function-classes.
*/
EOT
);
$this->addDocumentation(" public Function() {", <<<EOT
/**
* Default Function constructor.
*/
EOT
);
$this->addDocumentation(' public static final int CONSTRUCTOR', <<<EOT
@ -187,6 +201,12 @@ EOT
* $documentation
*/
EOT
);
$this->addDocumentation(" public $class_name() {", <<<EOT
/**
* Default class constructor.
*/
EOT
);
}

View File

@ -234,8 +234,11 @@ std::string TD_TL_writer_java::gen_class_begin(const std::string &class_name, co
full_class_name += "<" + fetched_type + ">";
}
std::string result = " public " + std::string(is_proxy ? "abstract " : "") + full_class_name + " {\n";
if (is_proxy) {
result += " public " + class_name + "() {\n }\n";
}
if (class_name == gen_base_tl_class_name() || class_name == gen_base_function_class_name()) {
result += " public native String toString();\n";
result += "\n public native String toString();\n";
}
return result;