Back to Java User Group Home Print this page

Java User Group

February 2019 Meeting Information

Tweet

February 18, 2019
Alternates to Java Reflection and Unsafe Usage

We are happy to announce that Chandra Guntur will be our special guest for this month's meeting.

This session covers Method and Var Handles. Attendees can code along/download the “kata” with failing tests that need to be fixed with the provided hints. The session focuses on a live demonstration of a few tests being fixed to explain the differences between erstwhile Reflection API and the lightweight replacements introduced via Method Handles. Additionally, the session will also cover the (ab)use of sun.misc.Unsafe and its newer safer complimentary VarHandles.

Java reflection has always been a subtle presence since Java 1.1 (circa 1997) but when used it does present challenges that are visible only at runtime and also subverts the “strongly typed” nature of the Java language.

This session highlights JSR 292 (Da Vinci Machine Project), set out to ease the implementations of dynamic language implementation and improve their performance on the JVM; chief among them being the lightweight references to methods. Several code examples are then shown that demonstrate how a parity between the heavyweight reflection API of the yore can be achieved with a cleaner, modern and more lightweight API that is as performant as a statically linked Java call.

Examples of the usage of sun.misc.Unsafe and its newer complementary API in Var Handles is similarly demonstrated with some code samples that will be made public for post-session offline experimentation by attendees.

Meetings are held every second Tuesday of the month at the Dorothy Young Center for the Arts, Room 106, at Drew University starting promptly at 6:30pm. Meetings are open to the public, and visitors are encouraged to join ACGNJ.

SIG Leader Mike Redlich
E-Mail mike@redlich.net
Phone: (908) 246-0410