Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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);
  }


why not use .getDeclaredMethods()?


no real reason :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: