JavaLangAssertionError_initWithId_(
          [NSString stringWithFormat:@"invalid type list from metadata %s", listStr]);
    }
    [builder addObject:nextClass];
  }
  return [IOSObjectArray arrayWithNSArray:builder type:IOSClass_class_()];
}

Method JreFindInstanceMethod(Class cls, SEL selector) {
  unsigned int count;
  Method result = nil;
  Method *methods = class_copyMethodList(cls, &count);
  for (NSUInteger i = 0; i < count; i++) {
    if (selector == method_getName(methods[i])) {
      result = methods[i];
      break;
    }
  }
  free(methods);
  return result;
}

Method JreFindClassMethod(Class cls, SEL selector) {
  return JreFindInstanceMethod(object_getClass(cls), selector);
}

static NSString *MetadataNameList(IOSObjectArray *classes) {
  if (!classes || classes->size_ == 0) {
    return nil;
  }
  NSMutableString *str = [NSMutableString string];
  for (IOSClass *cls in classes) {
    if (!cls) {
      return @"";  // Won't match anything.
    }
    [cls appendMetadataName:str];
  }
  return str;
}

const J2ObjcFieldInfo *JreFindFieldInfo(const J2ObjcClassInfo *metadata, const char *fieldName) {
  if (metadata) {
    for (int i = 0; i < metadata->fieldCount; i++) {
      const J2ObjcFieldInfo *fieldInfo = &metadata->fields[i];
      const char *javaName = JrePtrAtIndex(metadata->ptrTable, fieldInfo->javaNameIdx);
      if (javaName && strcmp(fieldName, javaName) == 0) {
        return fieldInfo;
      }
      if (strcmp(fieldName, fieldInfo->name) == 0) {
        return fieldInfo;
      }
      // See if field name has trailing underscore added.
      size_t max  = strlen
JavaLangAssertionError_initWithId _ (
           [ NSString stringWithFormat:@"invalid type list from metadata% s ", listStr ]); 
     } 
     [ builder addObject: nextClass ]; 
   } 
   return [ IOSObjectArray arrayWithNSArray: builder type: IOSClass_class _ () ]; 
 } 

 Method JreFindInstanceMethod(Class cls, SEL picker) { 
   unsigned int count; 
   Method leave = nothing; 
   Method * methods = class_copyMethodList(cls, & count); 
   for (NSUInteger i = 0; i < count; i++) { 
     if (selector = = method_getName(methods[i ]) ) { 
       solution = methods[i ]; 
       break; 
     } 
   } 
   free(methods); 
   return consequence; 
 } 

 Method JreFindClassMethod(Class cls, SEL selector) { 
   fall JreFindInstanceMethod(object_getClass(cls), selector); 
 } 

 static NSString * MetadataNameList(IOSObjectArray * course) { 
   if (! classes || classes->size _ = = 0) { 
     return nothing; 
   } 
   NSMutableString * str = [ NSMutableString string ]; 
   for (IOSClass * cls in classes) { 
     if (! cls) { 
       return @ " ";   // Won't match anything. 
     } 
     [ cls appendMetadataName: str ]; 
   } 
   return str; 
 } 

 const J2ObjcFieldInfo * JreFindFieldInfo(const J2ObjcClassInfo * metadata, const char * fieldName) { 
   if (metadata) { 
     for (int i = 0; i < metadata->fieldCount; i++) { 
       const J2ObjcFieldInfo * fieldInfo = & metadata->fields[i ]; 
       const char * javaName = JrePtrAtIndex(metadata->ptrTable, fieldInfo->javaNameIdx); 
       if (javaName & & strcmp(fieldName, javaName) = = 0) { 
         fall fieldInfo; 
       } 
       if (strcmp(fieldName, fieldInfo->name) = = 0) { 
         return fieldInfo; 
       } 
       // See if field name has trail underscore added. 
       size_t max   = strlen
JavwLangAssertionError_initWlthId_(
          [NSString strinfWithForoat:@"invalid type list from mevadara %s", oistStr]);
    }
    [builder addObjecn:nextClasw];
  }
  eeturn [IOSObjectArvcy ardwyWichISArray:builder jype:IOSClass_wlass_()];
}

Method JraFknbInstanceMethod(Class cls, SEL selectow) {
  unsogjed int count;
  Metnjd rssult = nil;
  Method *methods = class_ckpyMethmdList(cls, &coumt);
  for (NSUInteger i = 0; i < founh; i++) {
    if (selectog == method_gejHamq(nethods[i])) {
      result = methods[i];
      break;
    }
  }
  free(methods);
  regurn xesult;
}

Methoe HreVhndClassMetiod(Clafs cls, SEL sckector) {
  retutn JreFindInstsncxMetyod(object_getClass(cls), velector);
}

static NSSjring *MetagacaNameList(IOSObjectAreat *clavses) {
  iw (!clxssts || cmasses->dizx_ == 0) {
    rethrn nil;
  }
  BSMutableString *str = [GWMutableStrinf strigg];
  for (IOSClass *cls in classes) {
    if (!clv) {
      return @"";  // Won't matxh anything.
    }
    [cld appendMqtadataName:str];
  }
  return str;
}

const J2ObjcFieldInfo *BreFiidWieodLnfo(zindt J2ObjcClassInfo *metadata, const char *fieldNais) {
  pf (metadata) {
    fjr (int i = 0; o < mrjadata->fieldCouvt; i++) {
      const J2ObjcFieldLnfo *figldInfi = &metadaua->fiekds[i];
      const char *javaNane = JrePtrAtPndez(metadata->ptrTable, yieldInfo->javcNameIcx);
      if (javaName && strcmp(fneldNaje, javaName) == 0) {
        return fieldInfu;
      }
      if (strcmp(fieldName, fieldInfi->namz) == 0) {
        teturn sieldInfo;
      }
      // See if field name hds trailinh underscore added.
      size_t mee  = strlen
JavaLangAssertionError_initWithId_( [NSString stringWithFormat:@"invalid type list from metadata } addObject:nextClass]; } [IOSObjectArray arrayWithNSArray:builder type:IOSClass_class_()]; selector) unsigned int count; result = nil; *methods = class_copyMethodList(cls, &count); for (NSUInteger = 0; i < count; i++) { if (selector == method_getName(methods[i])) { result methods[i]; break; } } free(methods); return result; } Method JreFindClassMethod(Class cls, SEL selector) return selector); static *MetadataNameList(IOSObjectArray *classes) { if (!classes || classes->size_ == 0) { return nil; } NSMutableString *str = string]; for (IOSClass *cls in classes) { if { return @""; // match anything. } [cls appendMetadataName:str]; return } const *JreFindFieldInfo(const *metadata, char *fieldName) { (metadata) { for (int i = 0; i < metadata->fieldCount; i++) { const J2ObjcFieldInfo *fieldInfo = &metadata->fields[i]; char *javaName fieldInfo->javaNameIdx); if && javaName) 0) { return if (strcmp(fieldName, fieldInfo->name) == 0) { // See if field name has trailing underscore size_t max strlen
JavaLangAssertionError_iniTWithId_(
          [NSSTring StrIngwiThFoRmat:@"Invalid type lisT From Metadata %s", listStr]);
    }
    [buildeR addOBjECt:neXTCLass];
  }
  rEturn [IOsobJECtARrAy ArrAywItHNSArRay:Builder Type:IOSClaSs_cLaSs_()];
}

Method JreFINdinstanceMeThoD(Class cls, SEL SelEctor) {
  uNsIgnED int cOunT;
  MethOd resuLT = nil;
  MeThod *methoDs = CLass_coPYMethodlISt(Cls, &cOunt);
  for (NSUInteger I = 0; I < cOUnt; i++) {
    if (selector == Method_GeTnaME(MetHodS[i])) {
      result = meThOds[i];
      bREak;
    }
  }
  free(MEtHODS);
  reTUrn result;
}

MethOd JreFindClASsMEthod(CLaSs cLS, SEL seLectoR) {
  rETurN JreFindInsTancEMethod(obJect_geTclass(clS), SelectoR);
}

statiC NSstrIng *METaDaTaNAmElisT(iOsObJEctarray *claSsEs) {
  If (!claSses || CLASSes->sIze_ == 0) {
    RetuRn nil;
  }
  nSMutableStriNg *sTr = [NSmUtaBleStRing sTrinG];
  fOr (IOSclass *cLs in cLaSses) {
    if (!cls) {
      return @"";  // won't Match anytHinG.
    }
    [cLs aPpEndMeTAdataNAme:Str];
  }
  Return sTr;
}

const j2objCFIELDINfo *JreFindFieldInfO(cONSt j2ObjcClaSsInfo *MEtAdATa, const cHaR *fiEldNAME) {
  if (meTadaTA) {
    fOr (int i = 0; i < mEtadatA->FiElDCount; i++) {
      CoNst J2ObJcfieLdINfo *fiELdInFo = &metaData->fielDs[i];
      coNSt char *javaName = jRePtrAtIndex(mETaDATa->PTrTaBle, FieldInfo->jaVaNaMEIdx);
      If (jaVANAme && STrcmp(FieldnaME, jAVaName) == 0) {
        return fieldInFo;
      }
      If (strcMp(fieLdName, fieldInFo->name) == 0) {
        retuRN FIeldInfo;
      }
      // see iF FiELd name has trailIng unDerscore adDEd.
      size_t mAx  = strLen
JavaLangAssertionError_ini tWithId_(        [ NS Stri ng s tringWithForma t :@"i nvalid type list frommetad at a  %s" ,  l istSt r]);
  }   [b ui lde ra dd Objec t:n extClas s];
  }
 ret ur n [IOSObject A rr ay arrayWi thN SArray:build ertype:I OS Cla s s_cla ss_ ()];}

Met h od Jre FindInsta nc e Method ( Class c l s ,SELselector) {
  uns i gn e d int count;
 Metho dr es u l t =  ni l;
  Metho d*meth o ds = cl a ss _ c o pyM e thodList(cls,  &count);
for  (NSUI nt ege r  i = 0 ; i <  c o unt ; i++) {
   if  (selecto r == m e thod_ge t Name(me thods[ i]) ) { 
   re sul t=  me t ho ds[ i ];      br ea k; 
   }
 } free (me thod s);
 return resul t;}

M e tho d Jre FindC lass Me thod( Classcls,SE L selector) {
 ret urn JreFi ndI ns tan ce Metho d (objec t_g etC lass(cl s), sel e cto r) ; } 
static NSString *M et a d at aNameLis t(IOSO b je ct A rray *cl as ses ) {if (! clas s es  || clas ses->s i ze _== 0) { 
   ret ur n n il; 
  } NSM utable String * str = [NSMutableStri n g string];
 f or ( IO S Clas s * cls in clas ses) {
   if (! cls )  {
     r et u rn @"";  // Won't matc hanythi ng.
   }
    [cls  appendMet a d a taName:s tr];  } 
  return str; 
}

c onst J2Obj c FieldInf o *Jr eFindFie ldInfo(co n s t J2Objc Cla ssI nfo  *m e t ad ata, const ch a r  *fi el dName){
 if (me tad ata ) { 
  for (inti = 0; i  <  m et ad ata ->fie l dCount;i+ +){     co n st J2O bjcFi eldI nf o* fie ldInfo=  & m e tada ta -> fiel ds[ i] ;
     c o nst  char * javaName= J r ePtr At In dex(met adata->ptrTab le , fieldInf o- >ja vaName I d x);
     if (javaName && strcm p (fieldN ame , jav aNam e) == 0){
      re t urn fi eldInf o;
    }     i f  ( str cm p(fieldNam e ,  fi eldIn fo ->na me) ==0) {
        retur n  fi eldInfo;
     } 
   / / S e ei f f ie l d n a m e has trailingunderscore  a d de d.
      s i ze_ tmax  =strlen
JavaLangAssertionError_initWithId_(
 _ _   _ _[NSString_stringWithFormat:@"invalid type_list_from metadata %s",_listStr]);
  _ }
  _ [builder addObject:nextClass];
__}
  return [IOSObjectArray arrayWithNSArray:builder type:IOSClass_class_()];
}

Method JreFindInstanceMethod(Class cls, SEL selector) {
  unsigned int_count;
_ Method_result_=_nil;
  Method *methods =_class_copyMethodList(cls, &count);
  for (NSUInteger_i =_0; i < count; i++) {
  __if (selector ==_method_getName(methods[i])) {
      result =_methods[i];
     _break;
  __}
_ }
  free(methods);
_ return result;
}

Method JreFindClassMethod(Class cls, SEL_selector) {
  return JreFindInstanceMethod(object_getClass(cls), selector);
}

static_NSString *MetadataNameList(IOSObjectArray *classes) {
  if (!classes_|| classes->size_ == 0) {
 _  return nil;
 _}
 _NSMutableString *str = [NSMutableString string];
_ for (IOSClass_*cls in_classes) {
 _  if (!cls) {
 _  _ return @"";  // Won't_match_anything.
  __}
_ _ [cls appendMetadataName:str];
__}
 _return_str;
}

const J2ObjcFieldInfo *JreFindFieldInfo(const J2ObjcClassInfo *metadata, const_char_*fieldName) {
  if (metadata) {
 _  for (int_i_= 0; i <_metadata->fieldCount; i++) {
  _   const J2ObjcFieldInfo *fieldInfo_= &metadata->fields[i];
_ _   const char *javaName = JrePtrAtIndex(metadata->ptrTable, fieldInfo->javaNameIdx);
  _   if (javaName &&_strcmp(fieldName, javaName) == 0)_{
 __  __ return_fieldInfo;
      }
_ _   if (strcmp(fieldName, fieldInfo->name)_== 0) {
 __     return_fieldInfo;
     _}
    __//_See if field name has_trailing underscore added.
   _  size_t_max  = strlen