public final void renameClass(String oldname,String newname){
  ArrayList list;
  int n;
  if (oldname.equals(newname))   return;
  if (oldname.equals(thisclassname))   thisclassname=newname;
  oldname=Descriptor.toJvmName(oldname);
  newname=Descriptor.toJvmName(newname);
  constPool.renameClass(oldname,newname);
  AttributeInfo.renameClass(attributes,oldname,newname);
  list=methods;
  n=list.size();
  for (int i=0; i < n; ++i) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    String desc=minfo.getDescriptor();
    minfo.setDescriptor(Descriptor.rename(desc,oldname,newname));
    AttributeInfo.renameClass(minfo.getAttributes(),oldname,newname);
  }
  list=fields;
  n=list.size();
  for (int i=0; i < n; ++i) {
    FieldInfo finfo=(FieldInfo)list.get(i);
    String desc=finfo.getDescriptor();
    finfo.setDescriptor(Descriptor.rename(desc,oldname,newname));
    AttributeInfo.renameClass(finfo.getAttributes(),oldname,newname);
  }
}

public final void renameClass ( String oldname , String newname ) { ArrayList list ; int n ; if ( oldname . equals ( newname ) ) return ; if ( oldname . equals ( thisclassname ) ) thisclassname = newname ; oldname = Descriptor . toJvmName ( oldname ) ; newname = Descriptor . toJvmName ( newname ) ; constPool . renameClass ( oldname , newname ) ; AttributeInfo . renameClass ( attributes , oldname , newname ) ; list = methods ; n = list . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { MethodInfo minfo = ( MethodInfo ) list . get ( i ) ; String desc = minfo . getDescriptor ( ) ; minfo . setDescriptor ( Descriptor . rename ( desc , oldname , newname ) ) ; AttributeInfo . renameClass ( minfo . getAttributes ( ) , oldname , newname ) ; } list = fields ; n = list . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { FieldInfo finfo = ( FieldInfo ) list . get ( i ) ; String desc = finfo . getDescriptor ( ) ; finfo . setDescriptor ( Descriptor . rename ( desc , oldname , newname ) ) ; AttributeInfo . renameClass ( finfo . getAttributes ( ) , oldname , newname ) ; } }
replaces all occurrences of a class name in the class file . < p > if class x is substituted for class y in the class file , x and y must have the same signature . if y provides a method m ( ) , x must provide it even if x inherits m ( ) from the super class . if this fact is not guaranteed , the bytecode verifier may cause an error .
