Lookup functions

Changes regarding lookup functions, for the Java 9 platform, include the following:

  • MethodHandles can now be bound to non-abstract methods in interfaces
  • The lookup API allows class lookups from different contexts

The MethodHandles.Lookup.findSpecial(Class<?> refs, String name, MethodType type, Class<?> specialCaller) class has been modified to permit locating super-callable methods on interfaces.

In addition, the following methods have been added to the MethodHandles.Lookup class:

  • Class<?> findClass(String targetName)
  • Class<?> accessClass(Class<?> targetClass)

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.