title: How do you get java method annotations to work in scala
body: <p>I've got two projects, a scala project and a java project. My scala project references the java project in the build path. In my java project, i'm declaring the following annotation:</p>
  
  <pre><code>@Target(ElementType.METHOD)
  @Retention(RetentionPolicy.RUNTIME)
  public @interface MyAnnotation {
      public String Name();
  }
  </code></pre>
  
  <p>In my scala project, I'm annotating some methods. I.e.</p>
  
  <pre><code>class MyClass {
      ...
      @MyAnnotation(Name="Blah")
      def myMethod() {
          ...
      }
  }
  </code></pre>
  
  <p>In another file somewhere, i'm trying to pull out the annotations.</p>
  
  <pre><code>var methods = myClassInstance.getClass().getDeclaredMethods()
  var myMethod : Method = null
  for (method &lt;- methods) {
    if (method.getName().equals("myMethod")) {
      myMethod = method
    }
  }
  var annotations = myMethod.getDeclaredAnnotations()
  </code></pre>
  
  <p>Unfortunately, <code>annotations</code> is always an empty array. Am I doing something fundamentally wrong or am I just missing something minor? Thanks!</p>
  
  <p><strong>EDIT</strong>
  Originally, I was annotating myMethod with myAnnotation twice, which is incorrect as someone pointed out. It turns out this wasn't the problem. I'm still getting an empty array for <code>annotations</code>. No exception is being thrown.</p>