class InstructionAdapter extends MethodVisitor {

  @Override
  public void visitLdcInsn(final Object value) {
    if (api < Opcodes.ASM5
        && (value instanceof Handle
            || (value instanceof Type && ((Type) value).getSort() == Type.METHOD))) {
      throw new UnsupportedOperationException("This feature requires ASM5");
    }
    if (api != Opcodes.ASM7 && value instanceof ConstantDynamic) {
      throw new UnsupportedOperationException("This feature requires ASM7");
    }
    if (value instanceof Integer) {
      iconst((Integer) value);
    } else if (value instanceof Byte) {
      iconst(((Byte) value).intValue());
    } else if (value instanceof Character) {
      iconst(((Character) value).charValue());
    } else if (value instanceof Short) {
      iconst(((Short) value).intValue());
    } else if (value instanceof Boolean) {
      iconst(((Boolean) value).booleanValue() ? 1 : 0);
    } else if (value instanceof Float) {
      fconst((Float) value);
    } else if (value instanceof Long) {
      lconst((Long) value);
    } else if (value instanceof Double) {
      dconst((Double) value);
    } else if (value instanceof String) {
      aconst(value);
    } else if (value instanceof Type) {
      tconst((Type) value);
    } else if (value instanceof Handle) {
      hconst((Handle) value);
    } else if (value instanceof ConstantDynamic) {
      cconst((ConstantDynamic) value);
    } else {
      throw new IllegalArgumentException();
    }
  }

  public  InstructionAdapter(final MethodVisitor methodVisitor);
  protected  InstructionAdapter(final int api, final MethodVisitor methodVisitor);

}