Hacker News new | ask | show | jobs
by _old_dude_ 3376 days ago
Even the Java compiler uses that trick, by example with a bridge method.

  public static void main(String[] args) {
    class Fun implements Supplier<String> {
      public String get() { return null; }
    }
    
    Arrays.stream(Fun.class.getMethods())
      .filter(m -> m.getDeclaringClass() == Fun.class)
      .forEach(System.out::println);
  }
1 comments

why not use .getDeclaredMethods()?
no real reason :)