Applied changes to jdk7 & jdk 9.