RenameClassAdapter extends AbstractClassAdapter { @Override protected String renameInternalType(String type) { if (type == null) { return null; } if (type.equals(mOldName)) { return mNewName; } if (!mOldBase.equals(mOldName) && type.equals(mOldBase)) { return mNewBase; } int pos = type.indexOf('$'); if (pos == mOldBase.length() && type.startsWith(mOldBase)) { return mNewBase + type.substring(pos); } return type; } RenameClassAdapter(ClassVisitor cv, String oldName, String newName);   }
@Test public void testRenameInternalType() { assertEquals("org.blah.New", mOuter.renameInternalType("com.pack.Old")); assertEquals("org.blah.New$Inner", mOuter.renameInternalType("com.pack.Old$Inner")); assertEquals("org.blah.New$Other", mInner.renameInternalType("com.pack.Old$Other")); assertEquals("org.blah.New$Other", mInner.renameInternalType("com.pack.Old$Other")); }