diff options
author | Tej Singh <singhtejinder@google.com> | 2020-02-20 18:14:50 -0800 |
---|---|---|
committer | Muhammad Qureshi <muhammadq@google.com> | 2020-03-05 01:06:57 -0800 |
commit | c88fbf1e1c110765f8de1d288a620896c8e96220 (patch) | |
tree | e261a2183b5df7f7d178c6d8bde8937e60d0a8a9 /tools/stats_log_api_gen/Collation.cpp | |
parent | 13805decc7ae08011019764acc3830366aa23d49 (diff) |
Fail if there are repeated fields in atoms.proto
Repeated fields arent allowed outside of attribution node and key value
pairs, so we should fail to build if someone attempts to add one.
Bug: 149956370
Test: atest stats-log-api-gen-test
Change-Id: I0caa6fcf74dabe8e962360ecccfd3a87fcaa4909
Merged-In: I0caa6fcf74dabe8e962360ecccfd3a87fcaa4909
Diffstat (limited to 'tools/stats_log_api_gen/Collation.cpp')
-rw-r--r-- | tools/stats_log_api_gen/Collation.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/stats_log_api_gen/Collation.cpp b/tools/stats_log_api_gen/Collation.cpp index 8bccd7150050..aa356f1c35d2 100644 --- a/tools/stats_log_api_gen/Collation.cpp +++ b/tools/stats_log_api_gen/Collation.cpp @@ -237,6 +237,16 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl, errorCount++; continue; } + + if (field->is_repeated() && + !(javaType == JAVA_TYPE_ATTRIBUTION_CHAIN || javaType == JAVA_TYPE_KEY_VALUE_PAIR)) { + print_error(field, + "Repeated fields are not supported in atoms. Please make field %s not " + "repeated.\n", + field->name().c_str()); + errorCount++; + continue; + } } // Check that if there's an attribution chain, it's at position 1. |