user918176 user918176 - 1 year ago 87
Java Question

How to prevent Java developers from using new language features?

Since Java SE 7 is EOL, upgrading to Java 8 is necessary. However there are business reasons to not allow the developers to use any of the new language features. The feature that is especially forbidden is lambdas.

How can the use of Java 7 features be enforced? The build system is based on Jenkins and there is also SonarQube available.

Answer Source

Other answers are partially right. Compiler must indeed be configured with -source 1.7 to check that no Java 8 lang features are used. But it does not prevent from using the new Java 8 APIs. A solution is to use the animal sniffer project to verify that only Java 7 APIs are used.

Here is a a sample of configuration for maven projects:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download