List of arrays is not supported.

We don't support List of arrays. However, the compiler was not checking
this and the generated code was not build-able.

Bug: 180255700
Test: aidl_unittests
Change-Id: I9cd80833fa0f149d8f1ffcbd6c352c6cdf82841d
diff --git a/aidl_language.cpp b/aidl_language.cpp
index 1616f22..8bd3c3b 100644
--- a/aidl_language.cpp
+++ b/aidl_language.cpp
@@ -532,6 +532,12 @@
         return false;
       }
       const AidlTypeSpecifier& contained_type = *GetTypeParameters()[0];
+      if (contained_type.IsArray()) {
+        AIDL_ERROR(this)
+            << "List of arrays is not supported. List<T> supports parcelable/union, String, "
+               "IBinder, and ParcelFileDescriptor.";
+        return false;
+      }
       const string& contained_type_name = contained_type.GetName();
       if (AidlTypenames::IsBuiltinTypename(contained_type_name)) {
         if (contained_type_name != "String" && contained_type_name != "IBinder" &&
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index 7ffe5f7..98dcdb7 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -3767,7 +3767,8 @@
 };
 
 const TypeParam kTypeParams[] = {
-    {"primitive", "int"},   {"String", "String"},
+    {"primitive", "int"},   {"primitiveArray", "int[]"},
+    {"String", "String"},   {"StringArray", "String[]"},
     {"IBinder", "IBinder"}, {"ParcelFileDescriptor", "ParcelFileDescriptor"},
     {"parcelable", "Foo"},  {"enum", "a.Enum"},
     {"union", "a.Union"},   {"interface", "a.IBar"},
@@ -3778,10 +3779,18 @@
     {"java_primitive", "A generic type cannot have any primitive type parameters."},
     {"ndk_primitive", "A generic type cannot have any primitive type parameters."},
     {"rust_primitive", "A generic type cannot have any primitive type parameters."},
+    {"cpp_primitiveArray", "List of arrays is not supported."},
+    {"java_primitiveArray", "List of arrays is not supported."},
+    {"ndk_primitiveArray", "List of arrays is not supported."},
+    {"rust_primitiveArray", "List of arrays is not supported."},
     {"cpp_String", ""},
     {"java_String", ""},
     {"ndk_String", ""},
     {"rust_String", ""},
+    {"cpp_StringArray", "List of arrays is not supported."},
+    {"java_StringArray", "List of arrays is not supported."},
+    {"ndk_StringArray", "List of arrays is not supported."},
+    {"rust_StringArray", "List of arrays is not supported."},
     {"cpp_IBinder", ""},
     {"java_IBinder", ""},
     {"ndk_IBinder", "List<IBinder> is not supported. List in NDK doesn't support IBinder."},
@@ -3813,10 +3822,18 @@
     {"java_primitive", ""},
     {"ndk_primitive", ""},
     {"rust_primitive", ""},
+    {"cpp_primitiveArray", "Can only have one dimensional arrays."},
+    {"java_primitiveArray", "Can only have one dimensional arrays."},
+    {"ndk_primitiveArray", "Can only have one dimensional arrays."},
+    {"rust_primitiveArray", "Can only have one dimensional arrays."},
     {"cpp_String", ""},
     {"java_String", ""},
     {"ndk_String", ""},
     {"rust_String", ""},
+    {"cpp_StringArray", "Can only have one dimensional arrays."},
+    {"java_StringArray", "Can only have one dimensional arrays."},
+    {"ndk_StringArray", "Can only have one dimensional arrays."},
+    {"rust_StringArray", "Can only have one dimensional arrays."},
     {"cpp_IBinder", ""},
     {"java_IBinder", ""},
     {"ndk_IBinder", "The ndk backend does not support array of IBinder"},