Adapt code to Java 7 + edit license