// Path: kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java
// static AnalysisResult analyse(
//     Class<?> klass, Constructor<?> constructor) throws IOException {
//   Class<?>[] parameterTypes = constructor.getParameterTypes();
//   InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class");
//   if (in == null) {
//     throw new IllegalArgumentException(format("can not find bytecode for %s", klass));
//   }
//   return analyse(in, klass.getName().replace('.', '/'),
//       klass.getSuperclass().getName().replace('.', '/'),
//       parameterTypes);
// }
// 
// Path: kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java
// static class FormalParameter implements JavaValue {
//   private final int index;
//   private final Class<?> kind;
//   FormalParameter(int index, Class<?> kind) {
//     this.index = index;
//     this.kind = kind;
//   }
//   @Override
//   public String toString() {
//     return format("p%s", index);
//   }
//   int getIndex() {
//     return index;
//   }
//   Class<?> getKind() {
//     return kind;
//   }
//   @Override
//   public boolean containsFormalParameter() {
//     return true;
//   }
// }
// 
// Path: kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java
// static class IllegalConstructorException extends RuntimeException {
// 
//   private static final long serialVersionUID = -7666362130696013958L;
// 
//   IllegalConstructorException() {
//   }
// 
//   IllegalConstructorException(String format, Object... args) {
//     super(format(format, args));
//   }
// 
// }


import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Maps.newHashMap;
import static com.kaching.platform.converters.ConstructorAnalysis.analyse;
import static java.math.BigDecimal.ZERO;
import static java.math.MathContext.DECIMAL32;
import static java.util.Collections.emptyMap;
import static junit.framework.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.junit.Ignore;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
import com.kaching.platform.converters.ConstructorAnalysis.FormalParameter;
import com.kaching.platform.converters.ConstructorAnalysis.IllegalConstructorException;
  }

  static class ContainerToTrickLibraryUsingAliasing { List<String> ref; }
  static class AliasingResolutionIsNotSupported {
    List<String> non_idempotent;
    AliasingResolutionIsNotSupported(
        ContainerToTrickLibraryUsingAliasing trick,
        List<String> names) {
      trick.ref = names;
      trick.ref.add(Integer.toString(trick.ref.size()));
      this.non_idempotent = names;
    }
  }

  @Test
  public void aliasingResolutionIsNotSupported() throws Exception {
    /* Due to the lack of support for aliasing, one can successfully trick the
     * analysis. This is not an important case to protect for.
     */
    assertAssignement(
        AliasingResolutionIsNotSupported.class,
        ImmutableMap.of(
            "non_idempotent", "p1"));
  }

  @Test
  public void regression1() throws IOException {
    InputStream classInputStream = this.getClass().getResourceAsStream("example_scala_class01.bin");
    assertNotNull(classInputStream);
    Map<String, FormalParameter> assignements =
// Path: kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java
// static AnalysisResult analyse(
//     Class<?> klass, Constructor<?> constructor) throws IOException {
//   Class<?>[] parameterTypes = constructor.getParameterTypes();
//   InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class");
//   if (in == null) {
//     throw new IllegalArgumentException(format("can not find bytecode for %s", klass));
//   }
//   return analyse(in, klass.getName().replace('.', '/'),
//       klass.getSuperclass().getName().replace('.', '/'),
//       parameterTypes);
// }
// 
// Path: kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java
// static class FormalParameter implements JavaValue {
//   private final int index;
//   private final Class<?> kind;
//   FormalParameter(int index, Class<?> kind) {
//     this.index = index;
//     this.kind = kind;
//   }
//   @Override
//   public String toString() {
//     return format("p%s", index);
//   }
//   int getIndex() {
//     return index;
//   }
//   Class<?> getKind() {
//     return kind;
//   }
//   @Override
//   public boolean containsFormalParameter() {
//     return true;
//   }
// }
// 
// Path: kawala-converters/src/main/java/com/kaching/platform/converters/ConstructorAnalysis.java
// static class IllegalConstructorException extends RuntimeException {
// 
//   private static final long serialVersionUID = -7666362130696013958L;
// 
//   IllegalConstructorException() {
//   }
// 
//   IllegalConstructorException(String format, Object... args) {
//     super(format(format, args));
//   }
// 
// }


// Path: kawala-converters/src/test/java/com/kaching/platform/converters/ConstructorAnalysisTest.java
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Maps.newHashMap;
import static com.kaching.platform.converters.ConstructorAnalysis.analyse;
import static java.math.BigDecimal.ZERO;
import static java.math.MathContext.DECIMAL32;
import static java.util.Collections.emptyMap;
import static junit.framework.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.junit.Ignore;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
import com.kaching.platform.converters.ConstructorAnalysis.FormalParameter;
import com.kaching.platform.converters.ConstructorAnalysis.IllegalConstructorException;

  }

  static class ContainerToTrickLibraryUsingAliasing { List<String> ref; }
  static class AliasingResolutionIsNotSupported {
    List<String> non_idempotent;
    AliasingResolutionIsNotSupported(
        ContainerToTrickLibraryUsingAliasing trick,
        List<String> names) {
      trick.ref = names;
      trick.ref.add(Integer.toString(trick.ref.size()));
      this.non_idempotent = names;
    }
  }

  @Test
  public void aliasingResolutionIsNotSupported() throws Exception {
    /* Due to the lack of support for aliasing, one can successfully trick the
     * analysis. This is not an important case to protect for.
     */
    assertAssignement(
        AliasingResolutionIsNotSupported.class,
        ImmutableMap.of(
            "non_idempotent", "p1"));
  }

  @Test
  public void regression1() throws IOException {
    InputStream classInputStream = this.getClass().getResourceAsStream("example_scala_class01.bin");
    assertNotNull(classInputStream);
    Map<String, FormalParameter> assignements =
      analyse(classInputStream,