Generating correct and efficient equality and hashing methods using JEqualityGen


Grech, Neville, Rathke, Julian and Fischer, Bernd (2010) Generating correct and efficient equality and hashing methods using JEqualityGen. In, Workshop on Generative Technologies, Paphos, Cyprus,

Download

[img] PDF
Download (205Kb)

Description/Abstract

Determining equality of objects in Java requires the implementation of equals and hashCode methods. Such an implementation has to follow a specific object contract, making it a very tedious and error-prone process. Many equality and hashing methods implemented in Java applications violate this contract and are faulty, due to complexity arising from field shadowing, comparisons between different types, object cycles, etc. Equality and hashing implementations are conceptually simple, and can be derived automatically from information obtained statically from the program. However, existing systems that generate equality implementations use reflection and are consequently inefficient. Here we describe JEqualityGen, a source code generator that seamlessly integrates with the build process of typical Java projects: the programmer only needs to indicate for which classes implementations should be generated. JEqualityGen produces correct and efficient code which on a typical large-scale Java application exhibits a typical performance improvement of 162x in the equality operations generated by existing reflective systems. This was made possible through the use of optimised code generation and runtime profiling of these methods.

Item Type: Conference or Workshop Item (Paper)
Additional Information: Event Dates: 27th March 2010
Divisions: Faculty of Physical Sciences and Engineering > Electronics and Computer Science > Electronic & Software Systems
ePrint ID: 268754
Date Deposited: 18 Mar 2010 10:27
Last Modified: 27 Mar 2014 20:15
Further Information:Google Scholar
URI: http://eprints.soton.ac.uk/id/eprint/268754

Actions (login required)

View Item View Item