Don't call virtual methods in TypeNamespace constructors
While probably safe in this particular context because of this specific
class structure, it is bad practice to call virtual methods in constructors.
Bug: None
Test: unittests continue to pass
Change-Id: I3c9a435efd89a2c2bd7ce576aed585b8ab766bda
diff --git a/aidl.cpp b/aidl.cpp
index 3cff7e0..a9b2d6e 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -561,6 +561,7 @@
unique_ptr<AidlInterface> interface;
std::vector<std::unique_ptr<AidlImport>> imports;
unique_ptr<cpp::TypeNamespace> types(new cpp::TypeNamespace());
+ types->Init();
int err = internals::load_and_validate_aidl(
std::vector<std::string>{}, // no preprocessed files
options.ImportPaths(),
@@ -583,6 +584,7 @@
unique_ptr<AidlInterface> interface;
std::vector<std::unique_ptr<AidlImport>> imports;
unique_ptr<java::JavaTypeNamespace> types(new java::JavaTypeNamespace());
+ types->Init();
int err = internals::load_and_validate_aidl(
options.preprocessed_files_,
options.import_paths_,