Move Java array prints into aidl_to_java.
Since it is annoying to try to remember to print them.
I've found ast_java is one of the big sources of leaks in AIDL, so I'm
trying to rewrite it, and I noticed this.
Bug: N/A
Test: ./runtests.sh
Change-Id: Ibf80fa58e922b522d2e39b3e259c2a166ce61ea7
diff --git a/ast_java.cpp b/ast_java.cpp
index 872a939..5eab218 100644
--- a/ast_java.cpp
+++ b/ast_java.cpp
@@ -105,16 +105,10 @@
to->Write("\"%s\"", this->value.c_str());
}
-Variable::Variable(const string& t, const string& n) : type(t), name(n), dimension(0) {}
-
-Variable::Variable(const string& t, const string& n, int d) : type(t), name(n), dimension(d) {}
+Variable::Variable(const string& t, const string& n) : type(t), name(n) {}
void Variable::WriteDeclaration(CodeWriter* to) const {
- string dim;
- for (int i = 0; i < this->dimension; i++) {
- dim += "[]";
- }
- to->Write("%s%s %s", this->type.c_str(), dim.c_str(), this->name.c_str());
+ to->Write("%s %s", this->type.c_str(), this->name.c_str());
}
void Variable::Write(CodeWriter* to) const { to->Write("%s", name.c_str()); }
@@ -366,11 +360,7 @@
SCOPE_MASK | STATIC | ABSTRACT | FINAL | OVERRIDE);
if (this->returnType) {
- string dim;
- for (i = 0; i < this->returnTypeDimension; i++) {
- dim += "[]";
- }
- to->Write("%s%s ", this->returnType->c_str(), dim.c_str());
+ to->Write("%s ", this->returnType->c_str());
}
to->Write("%s(", this->name.c_str());