Please look at javassist.expr.ExprEditor
for (1) and CtClass.setName() for (2).
Thanks chiba. But here what I want to change is not just the name of a class, but I mean a totally different class, including declaration of the class, its members and implementations, such and such. And even though I change the classname of one class, how to make changes to all the related classes that have referenced this name-changed class?
Ok, maybe what you need is CtClass.replaceClassName().
To apply this renaming to a set of classes,
you should call replaceClassName() on
every class. javassist.Translator would help you do this.