java: Fix method lookup from superclasses

Fix method lookup to scan superclasses. Fixes the following test case:

  public class Test {
    public static class A {
      public static void x() { }
    }

    public static class B extends A {
      public static void y() { x(); }
    }

    public static void main(String[] args) {
      B.y();
    }
  }

Signed-off-by: Pekka Enberg <penberg@kernel.org>