Refactor for 1.6 and 1.7 lines of jdk.