Java 1.5 support

Fixes #375