title: In Scala, how can I pass null to a Java method that expects Long?
body: <p>I have a Java method that accepts a Long value:</p>
  
  <pre><code>(in Java)
  public void setValue(Long value);
  </code></pre>
  
  <p>I understand that the Scala null does not extend any of the value types, including Long. Therefore, when I try to pass null to it, I get a compilation error:</p>
  
  <pre><code>(in Scala)
  javaThing.setValue(null)
  
  ==&gt; type mismatch; found  : Any required: java.lang.Long
  </code></pre>
  
  <p><strong>EDIT: aargh! Ignore above snippet. I oversimplified the problem, and got into trouble. In fact, problem arises from my use of Option[Long], as follows:</strong> </p>
  
  <pre><code>javaThing.setValue(calcValue.getOrElse(null))
  </code></pre>
  
  <p>The issue is, I think, that getOrElse evaluates to the Any type when given a null argument.</p>
  
  <p>Help!</p>