cloned from http://hg.openjdk.java.net/jdk7/jdk7/