Tentative fix for aidl import issue
Fix issue when aidl generation doesn't use the right type when
it is a suffix of a pre-declared type.
eg. android.location.Location and foo.android.location.Location. The
aidl generation will never use foo.android.location.Location.
The tentative fix reverses the order in which Namespace.Search iterates
through the known types.
A better fix would be to annotate the types that are declared in the
aidl import statements to be prioritary in Namespace.Search. Lmk if I
you agree with this approach and think that this is worth the work.
Thanks!
Change-Id: I97dd1a1d417075accf1d61f9aba5aba3dea175c6
diff --git a/tools/aidl/Type.cpp b/tools/aidl/Type.cpp
index d572af6..c637aee 100644
--- a/tools/aidl/Type.cpp
+++ b/tools/aidl/Type.cpp
@@ -1348,7 +1348,7 @@
// would be the place to do it, but I don't think the complexity in
// scoping rules is worth it.
int N = m_types.size();
- for (int i=0; i<N; i++) {
+ for (int i=N-1; i>=0; i--) {
if (m_types[i]->Name() == name) {
return m_types[i];
}