// Path: src/main/java/org/pantsbuild/jarjar/util/EntryStruct.java
// public class EntryStruct {
//     public byte[] data;
//     public String name;
//     public long time;
//     public boolean skipTransform;
// }
// 
// Path: src/main/java/org/pantsbuild/jarjar/util/JarProcessor.java
// public interface JarProcessor
// {
//     /**
//      * Process the entry (p.ex. rename the file)
//      * <p>
//      * Returns <code>true</code> if the processor "successfully" processed the entry. In practice,
//      * "true" is used to indicate that the entry should be kept, and false is used to indicate the
//      * entry should be thrown away, and doesn't indicate anything in particular about what this
//      * JarProcessor actually did to the entry (if anything).
//      *
//      * @param struct The jar entry.
//      * @return <code>true</code> if the process chain can continue after this process
//      * @throws IOException
//      */
//     boolean process(EntryStruct struct) throws IOException;
// }


import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.Remapper;
import org.pantsbuild.jarjar.util.EntryStruct;
import org.pantsbuild.jarjar.util.JarProcessor;
package org.pantsbuild.jarjar;


/**
 * Remaps string values representing method signatures to use the new package.
 *
 * <p>{@link PackageRemapper} is only able to remap string values which exactly match the package
 * being renamed. Method signatures are more difficult to detect so this class keeps track of which
 * methods definitely take method signatures and remaps those explicitly.
 */
public class MethodSignatureProcessor implements JarProcessor {

  /**
   * List of method names which take a method signature as their parameter.
   *
   * <p>Right now we assume all these methods take exactly one parameter and that it's a stirng.
   */
  private static final Set<String> METHOD_NAMES_WITH_PARAMS_TO_REWRITE =
      new HashSet<String>(Arrays.asList("getImplMethodSignature"));

  private final Remapper remapper;

  public MethodSignatureProcessor(Remapper remapper) {
    this.remapper = remapper;
  }

  @Override
// Path: src/main/java/org/pantsbuild/jarjar/util/EntryStruct.java
// public class EntryStruct {
//     public byte[] data;
//     public String name;
//     public long time;
//     public boolean skipTransform;
// }
// 
// Path: src/main/java/org/pantsbuild/jarjar/util/JarProcessor.java
// public interface JarProcessor
// {
//     /**
//      * Process the entry (p.ex. rename the file)
//      * <p>
//      * Returns <code>true</code> if the processor "successfully" processed the entry. In practice,
//      * "true" is used to indicate that the entry should be kept, and false is used to indicate the
//      * entry should be thrown away, and doesn't indicate anything in particular about what this
//      * JarProcessor actually did to the entry (if anything).
//      *
//      * @param struct The jar entry.
//      * @return <code>true</code> if the process chain can continue after this process
//      * @throws IOException
//      */
//     boolean process(EntryStruct struct) throws IOException;
// }


// Path: src/main/java/org/pantsbuild/jarjar/MethodSignatureProcessor.java
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.Remapper;
import org.pantsbuild.jarjar.util.EntryStruct;
import org.pantsbuild.jarjar.util.JarProcessor;

package org.pantsbuild.jarjar;


/**
 * Remaps string values representing method signatures to use the new package.
 *
 * <p>{@link PackageRemapper} is only able to remap string values which exactly match the package
 * being renamed. Method signatures are more difficult to detect so this class keeps track of which
 * methods definitely take method signatures and remaps those explicitly.
 */
public class MethodSignatureProcessor implements JarProcessor {

  /**
   * List of method names which take a method signature as their parameter.
   *
   * <p>Right now we assume all these methods take exactly one parameter and that it's a stirng.
   */
  private static final Set<String> METHOD_NAMES_WITH_PARAMS_TO_REWRITE =
      new HashSet<String>(Arrays.asList("getImplMethodSignature"));

  private final Remapper remapper;

  public MethodSignatureProcessor(Remapper remapper) {
    this.remapper = remapper;
  }

  @Override
  public boolean process(final EntryStruct struct) throws IOException {