title: Using Scala reflection with Java reflection
body: <p>I have a lot of code that has been using Java reflection to invoke arbitrary user-specified methods on Java objects, as part of a DSL.</p>
  
  <p>However, a lot of those Java objects, in practice, are Scala objects, and some of the methods on them are marked with the Scala <code>@deprecated</code> annotation. Unfortunately, Java's annotations mechanism cannot see Scala annotations, and until Scala 2.10 there was no convenient way (that I know of?) to get access to those annotations.</p>
  
  <p>I have finally upgraded to 2.10, and would like to be able to emit deprecation warnings from my DSL. However, I don't want to rewrite the entire evaluator (for now, at least) to use Scala reflection, so is there a convenient way to go from a <code>java.lang.reflect.Method</code> to something I can use Scala reflection on to figure out if the Scala method in question is deprecated? Or will I have to duplicate a lot of the existing method resolution logic using Scala reflection before I can get at that information?</p>
  
  <p>It looks like a <code>JavaToScala</code> class used to exist in Scala reflection, which had a <code>methodToScala</code> method in it that did what I want. The only trace I can find is <a href="http://code.google.com/p/dynamic-scala/source/browse/src/compiler/scala/reflect/runtime/JavaToScala.scala?spec=svn90d2bee45b25844f809f8c5300aefcb1bfe9e336&amp;r=90d2bee45b25844f809f8c5300aefcb1bfe9e336#411">here</a>, in a google code project. Why was the functionality moved out of core reflection? Or is it still there under a different name?</p>
  
  <p>Edit: It looks like the code in question lives on in <code>scala.reflect.runtime.JavaMirrors</code>, but unfortunately it's private (there's another <code>JavaMirrors</code> that is part of the public API, but doesn't provide any of what I need.) I can't figure out for the life of me if there's a "path" of invocations through a public API that takes me all the way down to the private <code>methodAsScala</code> buried deep within the private <code>JavaMirrors</code>. It's frustrating, to say the least :(</p>