Properly handle premgen for sun jdk8+