title: JVM language interoperability
body: <p>Recently I've been writing a compiler for a JVM programming language and I've realised a problem.    </p>
  
  <p>I would like to access a Java method from my programming language and also allow a Java method to access a method in my language. The problem is that I need to know the Java methods signature to call it in the bytecode I generate and vice versa.  </p>
  
  <p>I've been trying to think of any methods for how Scala does this. Here are my thoughts. </p>
  
  <ol>
  <li>Scala accesses the <code>.java</code> files on the class path and parses them, extracting the method signatures from there.    </li>
  <li><code>.java</code> files are compiled to <code>.class</code> files. The Java ASM library is then used to access the <code>.class</code> files and get the method signatures. The problem with this method is that the <code>.java</code> files must be compiled first.     </li>
  <li><code>.java</code> files are loaded dynamically using reflection. The problem with this is I believe that the JVM doesn't allow for loading classes that are outside of the compilers class path.    </li>
  </ol>
  
  <p>Looking into Scala it works well with other JVM languages but I can't find information on exactly how it does it.</p>
  
  <p>How does Scala get method signatures of other JVM language methods? </p>