title: Kotlin: java.lang.NoSuchMethodError in tests
body: <p>Is it possible to use Kotlin package functions and package properties in different sourcesets? When I try to do so, I have <code>NoSuchMethodError</code> thrown.</p>
  
  <hr>
  
  <p><strong>Example</strong></p>
  
  <p>I have Gradle project with Kotlin code and two sourcesets in it, <code>main</code> and <code>test</code>.
  In <code>main</code>, I have the following code in one of the files:</p>
  
  <pre><code>package ru.ifmo.ctddev.igushkin.dkvs
  ...
  public val payloadSplitter: String = " ### "
  </code></pre>
  
  <p>In <code>test</code> I try to access <code>payloadSplitter</code> with the following code:</p>
  
  <pre><code>package ru.ifmo.ctddev.igushkin.dkvs
  ...
  public class MessageTests {
      ...
      test fun testParsing() {
          ...
          checkParseAndToString("p1b 345 ${payloadSplitter} set a b c")
      }
      ...
  }
  </code></pre>
  
  <p>And exactly in the first line where <code>payloadSplitter</code> is accessed, at runtime I get</p>
  
  <pre><code>java.lang.NoSuchMethodError: ru.ifmo.ctddev.igushkin.dkvs.DkvsPackage.getPayloadSplitter()Ljava/lang/String;
  </code></pre>
  
  <hr>
  
  <p>Other global variables and functions are also inaccessible in <code>test</code> with the same error.</p>
  
  <hr>
  
  <p><strong>UPD</strong> Kotlin team explained the issue and announced the fix <a href="http://blog.jetbrains.com/kotlin/2015/06/improving-java-interop-top-level-functions-and-properties/" rel="noreferrer">here</a>.</p>