}
}
private void writeInnerClasses( CtClass c, String obfOuterClassName, Collection<String> obfInnerClassNames )
{
InnerClassesAttribute attr = new InnerClassesAttribute( c.getClassFile().getConstPool() );
c.getClassFile().addAttribute( attr );
for( String obfInnerClassName : obfInnerClassNames )
{
// get the new inner class name
ClassEntry obfClassEntry = new ClassEntry( obfOuterClassName + "$" + obfInnerClassName );
// here's what the JVM spec says about the InnerClasses attribute
// append( inner, outer of inner if inner is member of outer 0 ow, name after $ if inner not anonymous 0 ow, flags );
// update the attribute with this inner class
ConstPool constPool = c.getClassFile().getConstPool();
int innerClassIndex = constPool.addClassInfo( obfClassEntry.getName() );
int outerClassIndex = 0;
int innerClassSimpleNameIndex = 0;
if( !m_jarIndex.isAnonymousClass( obfInnerClassName ) )
{
outerClassIndex = constPool.addClassInfo( obfClassEntry.getOuterClassName() );
innerClassSimpleNameIndex = constPool.addUtf8Info( obfClassEntry.getInnerClassName() );
}
attr.append(
innerClassIndex,
outerClassIndex,
innerClassSimpleNameIndex,
c.getClassFile().getAccessFlags() & ~AccessFlag.SUPER
);