aboutsummaryrefslogtreecommitdiff
path: root/aidl_checkapi.cpp
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2020-11-27 14:20:20 +0900
committerJooyung Han <jooyung@google.com>2020-11-30 04:18:49 +0000
commit000732776ae95969d115fb17bc2bffcff2e69ffa (patch)
tree90026714fd885a600bfb0f236fbacf0bffc82221 /aidl_checkapi.cpp
parentb3ca630d4892a2c9d6df170ee8a424e74a995e2c (diff)
downloadaidl-000732776ae95969d115fb17bc2bffcff2e69ffa.tar.gz
checkapi: allow adding @Deprecated
@JavaPassthrough(annotation="@Deprecated") is now considered as a compatible change. Checkapi ignores it. Bug: 174327111 Test: aidl_unittests Change-Id: I3e43736732929baf63393b3c0bf2bdcaf412e84e
Diffstat (limited to 'aidl_checkapi.cpp')
-rw-r--r--aidl_checkapi.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/aidl_checkapi.cpp b/aidl_checkapi.cpp
index 9d9387cc..d752f449 100644
--- a/aidl_checkapi.cpp
+++ b/aidl_checkapi.cpp
@@ -32,6 +32,7 @@ namespace aidl {
using android::base::Error;
using android::base::Result;
+using android::base::StartsWith;
using std::map;
using std::set;
using std::string;
@@ -61,9 +62,15 @@ static vector<string> get_strict_annotations(const AidlAnnotatable& node) {
};
vector<string> annotations;
for (const AidlAnnotation& annotation : node.GetAnnotations()) {
- if (kIgnoreAnnotations.find(annotation.GetType()) == kIgnoreAnnotations.end()) {
- annotations.push_back(annotation.ToString());
+ if (kIgnoreAnnotations.find(annotation.GetType()) != kIgnoreAnnotations.end()) {
+ continue;
+ }
+ auto annotation_string = annotation.ToString();
+ // adding @Deprecated (with optional args) is okay
+ if (StartsWith(annotation_string, "@JavaPassthrough(annotation=\"@Deprecated")) {
+ continue;
}
+ annotations.push_back(annotation_string);
}
return annotations;
}