Merge internal changes

(This also adds one external-only commit that we'll need to pull back in, to workaround jdk6 issues.)