Propagate interface annotations to methods

Change-Id: I85f9686e4b5df7df0d9fb77e6a1b50a93ff3e2d7
Test: Unit tests pass
Bug: 26911508
diff --git a/aidl.cpp b/aidl.cpp
index 6cc25a0..c60626f 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -189,6 +189,12 @@
                 TypeNamespace* types) {
   int err = 0;
 
+  if (c->IsUtf8() && c->IsUtf8InCpp()) {
+    cerr << filename << ":" << c->GetLine()
+         << "Interface cannot be marked as both @utf8 and @utf8InCpp";
+    err = 1;
+  }
+
   // Has to be a pointer due to deleting copy constructor. No idea why.
   map<string, const AidlMethod*> method_names;
   for (const auto& m : c->GetMethods()) {
@@ -199,7 +205,7 @@
     }
 
     const ValidatableType* return_type =
-        types->GetReturnType(m->GetType(), filename);
+        types->GetReturnType(m->GetType(), filename, *c);
 
     if (!return_type) {
       err = 1;
@@ -221,7 +227,7 @@
       }
 
       const ValidatableType* arg_type =
-          types->GetArgType(*arg, index, filename);
+          types->GetArgType(*arg, index, filename, *c);
 
       if (!arg_type) {
         err = 1;