title: Scala option parsing with scopt
body: <p>Using scopt <a href="https://github.com/scopt/scopt" rel="noreferrer">https://github.com/scopt/scopt</a></p>
  
  <p>I have a very simple Scala CLI driver that errors out on the first line of .parse. The line is var i = 0, can’t imagine why that would fail, maybe in how i instantiated the OptionParser?</p>
  
  <pre><code>def parse(args: Seq[String], init: C): Option[C] = {
    var i = 0 &lt;———————————————— prints the error below
    val pendingOptions = ListBuffer() ++ (nonArgs filterNot {_.hasParent})
  
  Exception in thread "main" java.lang.NoSuchMethodError: scala.runtime.IntRef.create(I)Lscala/runtime/IntRef;
  at scopt.OptionParser.parse(options.scala:306)
  at org.apache.mahout.drivers.ItemSimilarityDriver$.main(ItemSimilarityDriver.scala:47)
  at org.apache.mahout.drivers.ItemSimilarityDriver.main(ItemSimilarityDriver.scala)
  </code></pre>
  
  <p>Full code here, sorry but I’m new to Scala so this may be a really stupid question</p>
  
  <pre><code>object ItemSimilarityDriver {
    /**
     * @param args  Command line args, if empty a help message is printed.
     * @return
     */
  
  def main(args: Array[String]): Unit = {
  
      val parser = new OptionParser[Config]("ItemSimilarity") {
        head("ItemSimilarity", "Spark")
        opt[Unit]('r', "recursive") action { (_, c) =&gt;
          c.copy(recursive = true) } text("The input path should be searched recursively for files that match the filename pattern (optional), Default: false.")
        opt[String]('o', "output") required() action { (x, c) =&gt;
          c.copy(output = x) } text("Output is a path for all output (required)")
        opt[String]('i', "input") required()  action { (x, c) =&gt;
          c.copy(input = x) } text("Input is a path for input, it may be a filename or dir name. If a directory it will be searched for files matching the -p pattern. (required)")
        note("some notes.\n")
        help("help") text("prints this usage text")
      }
      // parser.parse returns Option[C]
      parser.parse(args, Config()) map { config =&gt;  &lt;—————————— parser was created 
                                                    but this call fails in the parse
        // do stuff
        //val didIt = true
      } getOrElse {
        // arguments are bad, error message will have been displayed, throw exception, run away!
      }
  
    }
  
    case class Config(recursive: Boolean = false, input: String = null, output: String = null)
  
  }
  </code></pre>
  
  <p>I've also tried the mutable options method with the same error.</p>