Make aidl annotate onTransact with @Override
BUG: 1902262
diff --git a/tools/aidl/AST.cpp b/tools/aidl/AST.cpp
index 91802a9..85ca5da 100755
--- a/tools/aidl/AST.cpp
+++ b/tools/aidl/AST.cpp
@@ -6,6 +6,10 @@
{
int m = mod & mask;
+ if (m & OVERRIDE) {
+ fprintf(to, "@Override ");
+ }
+
if ((m & SCOPE_MASK) == PUBLIC) {
fprintf(to, "public ");
}
@@ -79,7 +83,7 @@
if (this->comment.length() != 0) {
fprintf(to, "%s\n", this->comment.c_str());
}
- WriteModifiers(to, this->modifiers, SCOPE_MASK | STATIC | FINAL);
+ WriteModifiers(to, this->modifiers, SCOPE_MASK | STATIC | FINAL | OVERRIDE);
fprintf(to, "%s %s", this->variable->type->QualifiedName().c_str(),
this->variable->name.c_str());
if (this->value.length() != 0) {
@@ -674,7 +678,7 @@
fprintf(to, "%s\n", this->comment.c_str());
}
- WriteModifiers(to, this->modifiers, SCOPE_MASK | STATIC | FINAL);
+ WriteModifiers(to, this->modifiers, SCOPE_MASK | STATIC | FINAL | OVERRIDE);
if (this->returnType != NULL) {
string dim;
diff --git a/tools/aidl/AST.h b/tools/aidl/AST.h
index aec2164..3156356 100755
--- a/tools/aidl/AST.h
+++ b/tools/aidl/AST.h
@@ -22,6 +22,8 @@
FINAL = 0x00000020,
ABSTRACT = 0x00000040,
+ OVERRIDE = 0x00000100,
+
ALL_MODIFIERS = 0xffffffff
};
diff --git a/tools/aidl/generate_java.cpp b/tools/aidl/generate_java.cpp
index e3c0af0..622b691 100644
--- a/tools/aidl/generate_java.cpp
+++ b/tools/aidl/generate_java.cpp
@@ -103,7 +103,7 @@
this->transact_reply = new Variable(PARCEL_TYPE, "reply");
this->transact_flags = new Variable(INT_TYPE, "flags");
Method* onTransact = new Method;
- onTransact->modifiers = PUBLIC;
+ onTransact->modifiers = PUBLIC | OVERRIDE;
onTransact->returnType = BOOLEAN_TYPE;
onTransact->name = "onTransact";
onTransact->parameters.push_back(this->transact_code);