The history of all programming languages exposes the introduction of new language features. In the case of Java---a widespread general purpose language---multiple language extensions were applied over the last years and new ones are planned for the future. Often, such language extensions provide means to replace complex constructs with more compact ones. To benefit from new language extensions for large bodies of existing source code, a technique is required that performs the modernisation of existing source code automatically.
Using JaMoPP one can apply model transformations to perform model-driven modernisation of Java programs. We did so by applying two concrete transformations to large open source projects. We migrated classical for loops to the new for-each style (introduced in Java 5), and we converted anonymous classes to closures (planned for Java 8). The two QVTO transformations that perform this taks can be found below.