{
val.renameObfClass( entry.getKey(), entry.getValue() );
}
// pass 2: look for fields/methods that are actually declared in superclasses
MappingsRenamer renamer = new MappingsRenamer( m_jarIndex, val );
for( ClassMapping classMapping : val.classes() )
{
ClassEntry obfClassEntry = new ClassEntry( classMapping.getObfName() );
// fields
for( FieldMapping fieldMapping : Lists.newArrayList( classMapping.fields() ) )
{
FieldEntry fieldEntry = new FieldEntry( obfClassEntry, fieldMapping.getObfName() );
ClassEntry resolvedObfClassEntry = m_jarIndex.resolveEntryClass( fieldEntry );
if( resolvedObfClassEntry != null && !resolvedObfClassEntry.equals( fieldEntry.getClassEntry() ) )
{
boolean wasMoved = renamer.moveFieldToObfClass( classMapping, fieldMapping, resolvedObfClassEntry );
if( wasMoved )
{
System.out.println( String.format( "Moved field %s to class %s", fieldEntry, resolvedObfClassEntry ) );
}
else
{
System.err.println( String.format( "WARNING: Would move field %s to class %s but the field was already there. Dropping instead.", fieldEntry, resolvedObfClassEntry ) );
}
}
}
// methods
for( MethodMapping methodMapping : Lists.newArrayList( classMapping.methods() ) )
{
// skip constructors
if( methodMapping.isConstructor() )
{
continue;
}
MethodEntry methodEntry = new MethodEntry( obfClassEntry, methodMapping.getObfName(), methodMapping.getObfSignature() );
ClassEntry resolvedObfClassEntry = m_jarIndex.resolveEntryClass( methodEntry );
if( resolvedObfClassEntry != null && !resolvedObfClassEntry.equals( methodEntry.getClassEntry() ) )
{
boolean wasMoved = renamer.moveMethodToObfClass( classMapping, methodMapping, resolvedObfClassEntry );
if( wasMoved )
{
System.out.println( String.format( "Moved method %s to class %s", methodEntry, resolvedObfClassEntry ) );
}
else