Backport of some JDK8 features for JDK7