Sync with 2.1.6, compile with JDK 1.7, fix warnings and use generics in some places.

I've also move the main sources inside a main subdirectory which makes it a bit easier to identify and manage the source code.