/**
  * Resolves a name
  *
  * @param  lang.ClassLoader $cl
  * @param  string[] $namespaces
  * @param  string $name
  * @return lang.XPClass
  */
 private function resolveType($cl, $namespaces, $name)
 {
     if (strstr($name, '.')) {
         return $cl->loadClass($name);
     } else {
         foreach ($namespaces as $namespace) {
             if ($cl->providesClass($qualified = $namespace . '.' . $name)) {
                 return $cl->loadClass($qualified);
             }
         }
         throw new ClassNotFoundException('[' . implode(', ', $namespaces) . '].' . $name);
     }
 }