Jabel brings post-Java 8 features to Java 8 users

Jabel brings post-Java 8 features to Java 8 users


Jabel brings post-Java 8 features to Java 8 users | InfoWorld

 while taking advantage of the latest Java syntax and features? A tool called enables this because, as its GitHub page states, “life is too short to wait for your users to upgrade their Java.”

Jabel is an “annotation processor” that instruments Java compiler classes and treats some Java 9 and later language features as if they were supported in Java 8. The result is valid Java 8 bytecode for switch expressions, var declarations, and other features not supported in Java 8. Basically, Jabel tricks the compiler into thinking that certain features were developed for Java 8 by removing the checks that report them as invalid for the Java 8 target.

Jabel is in a proof of concept stage at this point, with developer Sergei Egorov even referring to it as a “hack.” The Jabel page stresses that the majority of open source libraries are still using Java 8 as their target. But since most new language features introduced after Java 8 did not require a change in bytecode, the javac compiler could emit Java 8 bytecode even when compiling sources from Java 12.

Jabel also allows developers to use . Java 13 is due for a production release on . Jabel is similar to , a Java library intended to reduce boilerplate code, but does not contain any business logic, Egorov said. In explaining his motivation behind developing Jabel, Egorov said other languages have adopted source transformation pipelines, particularly JavaScript, and this inspired him to try the same for Java. . The current release of .

Instructions on . A plug-in for Jabel is distributed with .