Remove dependency on internal JDK classes