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
This commit is contained in:
Laurent Tu
2013-02-14 16:12:54 -08:00
parent 00dcbf8f58
commit 4f115e08cb

View File

@@ -1348,7 +1348,7 @@ Namespace::Search(const string& name)
// 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];
}