RenameClassAdapter extends ClassAdapter { String renameTypeDesc(String desc) { if (desc == null) { return null; } return renameType(Type.getType(desc)); } RenameClassAdapter(ClassWriter cv, String oldName, String newName); @Override void visit(int version, int access, String name, String signature,
            String superName, String[] interfaces); @Override void visitInnerClass(String name, String outerName, String innerName, int access); @Override MethodVisitor visitMethod(int access, String name, String desc,
            String signature, String[] exceptions); @Override AnnotationVisitor visitAnnotation(String desc, boolean visible); @Override FieldVisitor visitField(int access, String name, String desc,
            String signature, Object value);  }
@Test public void testRenameTypeDesc() { assertEquals("I", mOuter.renameTypeDesc("I")); assertEquals("D", mOuter.renameTypeDesc("D")); assertEquals("V", mOuter.renameTypeDesc("V")); assertEquals("Lcom.package.MyClass;", mOuter.renameTypeDesc("Lcom.package.MyClass;")); assertEquals("Lcom.package.MyClass;", mInner.renameTypeDesc("Lcom.package.MyClass;")); assertEquals("Lorg.blah.New;", mOuter.renameTypeDesc("Lcom.pack.Old;")); assertEquals("Lorg.blah.New$Inner;", mInner.renameTypeDesc("Lcom.pack.Old$Inner;")); assertEquals("Lorg.blah.New$Other;", mOuter.renameTypeDesc("Lcom.pack.Old$Other;")); assertEquals("Lorg.blah.New$Other;", mInner.renameTypeDesc("Lcom.pack.Old$Other;")); assertEquals("[Lorg.blah.New;", mOuter.renameTypeDesc("[Lcom.pack.Old;")); assertEquals("[[Lorg.blah.New;", mOuter.renameTypeDesc("[[Lcom.pack.Old;")); assertEquals("[Lorg.blah.New;", mInner.renameTypeDesc("[Lcom.pack.Old;")); assertEquals("[[Lorg.blah.New;", mInner.renameTypeDesc("[[Lcom.pack.Old;")); }