title: Java Error: The method getMethod(String, Class<boolean>) is undefined for type Class
body: <p>I am trying to pass a method in as a parameter to a method in another class. The method is defined in the first class and the other class's method is static. Seeing it will make it easier to understand:</p>
  <h3>Setup</h3>
  <pre><code>public class MyClass extends ParentClass {
      public MyClass() {
          super(new ClickHandler() {
              public void onClick(ClickEvent event) {
                  try {
                      OtherClass.responseMethod(MyClass.class.getMethod(&quot;myMethod&quot;,Boolean.class));
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          });
      }
  
      public void myMethod(Boolean success) {
          if(success.booleanValue()) {
              //do stuff
          }
      }
  }
  </code></pre>
  <p><em>When I try to build</em>, though, I get the following error:</p>
  <h3>Error</h3>
  <pre><code>The method getMethod(String, Class&lt;boolean&gt;) is undefined for the type Class&lt;MyClass&gt;
  </code></pre>
  <p>The problem isn't that it's not finding <code>myMethod</code>, it's not finding <code>Class&lt;MyClass&gt;.getMethod</code> and I don't know why.</p>
  <h2>Update</h2>
  <p>We've reworked this part of the code and are not using 'getMethod<code>or</code>getDeclaredMethod`. Since npe found a couple of problems with what I was doing plus put a lot of effort into finding the answer, I'm accepting that answer.</p>