Method handles were introduced in Java 7 with invokedynamic support. Their applicability goes well beyond just supporting the invokedynamic bytecode though. They offer a cleaner, more elegant alternative to reflection. They also play a role in the implementation of lambda expressions in Java 8.
The method handles API provides a surprising number of conversion methods to transform existing method handles into new method handles, giving the API an almost functional feeling. The depth of the functionality provided by the method handles API speaks to the future of Java and its support for a more functional programming paradigm.
They don’t seem very glamorous. They are tucked away in the invoke package that was added in Java 7 for invokedynamic support. First glance might indicate their only purpose is to support dynamic language creators to make it easier to create an invocable object at runtime. But they are powerful. They behave like higher-order functions in many ways, almost giving Java a functional feel.
This talk will first describe what method handles are. Next we will examine how method handles can be used as a more elegant replacement for reflection. We will then explore the more functional capabilities provided by the API to extend existing method handles. Finally we will see how method handles are used in conjunction with the invokedynamic bytecode to support dynamic method invocation. We will also touch on how method handles relate to lambda expressions in Java 8.
About the Speaker:
Kirsten Schwark is a software developer for iDashboards (http://www.idashboards.com), a leading provider of business intelligence dashboard software. She is the author of the GroovyMag (http://groovymag.com) ‘Groovy under the Hood’ series that explores the Groovy programming language from the perspective of a Java developer. With over 17 years of software development experience she is an active supporter of the local development community.
Location and Parking map:
Please park in the two areas marked below as "Park Here" and use the entrance where its marked in red as "Enter Here"