Remove code dependencies on java 7